IxEthDBSpanningTree.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * @file IxEthDBSpanningTree.c
  3. *
  4. * @brief Implementation of the STP API
  5. *
  6. * @par
  7. * IXP400 SW Release version 2.0
  8. *
  9. * -- Copyright Notice --
  10. *
  11. * @par
  12. * Copyright 2001-2005, Intel Corporation.
  13. * All rights reserved.
  14. *
  15. * @par
  16. * SPDX-License-Identifier: BSD-3-Clause
  17. * @par
  18. * -- End of Copyright Notice --
  19. */
  20. #include "IxEthDB_p.h"
  21. /**
  22. * @brief sets the STP blocking state of a port
  23. *
  24. * @param portID ID of the port
  25. * @param blocked true to block the port or false to unblock it
  26. *
  27. * Note that this function is documented in the main component
  28. * header file, IxEthDB.h.
  29. *
  30. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  31. * or an appropriate error message otherwise
  32. */
  33. IX_ETH_DB_PUBLIC
  34. IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked)
  35. {
  36. IxNpeMhMessage message;
  37. IX_STATUS result;
  38. IX_ETH_DB_CHECK_PORT(portID);
  39. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  40. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
  41. ixEthDBPortInfo[portID].stpBlocked = blocked;
  42. FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked);
  43. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  44. return result;
  45. }
  46. /**
  47. * @brief retrieves the STP blocking state of a port
  48. *
  49. * @param portID ID of the port
  50. * @param blocked address to write the blocked status into
  51. *
  52. * Note that this function is documented in the main component
  53. * header file, IxEthDB.h.
  54. *
  55. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  56. * or an appropriate error message otherwise
  57. */
  58. IX_ETH_DB_PUBLIC
  59. IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
  60. {
  61. IX_ETH_DB_CHECK_PORT(portID);
  62. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  63. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
  64. IX_ETH_DB_CHECK_REFERENCE(blocked);
  65. *blocked = ixEthDBPortInfo[portID].stpBlocked;
  66. return IX_ETH_DB_SUCCESS;
  67. }