IxEthDBSpanningTree.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions
  18. * are met:
  19. * 1. Redistributions of source code must retain the above copyright
  20. * notice, this list of conditions and the following disclaimer.
  21. * 2. Redistributions in binary form must reproduce the above copyright
  22. * notice, this list of conditions and the following disclaimer in the
  23. * documentation and/or other materials provided with the distribution.
  24. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  25. * may be used to endorse or promote products derived from this software
  26. * without specific prior written permission.
  27. *
  28. * @par
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  30. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  33. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  35. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  36. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  37. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  38. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  39. * SUCH DAMAGE.
  40. *
  41. * @par
  42. * -- End of Copyright Notice --
  43. */
  44. #include "IxEthDB_p.h"
  45. /**
  46. * @brief sets the STP blocking state of a port
  47. *
  48. * @param portID ID of the port
  49. * @param blocked true to block the port or false to unblock it
  50. *
  51. * Note that this function is documented in the main component
  52. * header file, IxEthDB.h.
  53. *
  54. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  55. * or an appropriate error message otherwise
  56. */
  57. IX_ETH_DB_PUBLIC
  58. IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked)
  59. {
  60. IxNpeMhMessage message;
  61. IX_STATUS result;
  62. IX_ETH_DB_CHECK_PORT(portID);
  63. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  64. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
  65. ixEthDBPortInfo[portID].stpBlocked = blocked;
  66. FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked);
  67. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  68. return result;
  69. }
  70. /**
  71. * @brief retrieves the STP blocking state of a port
  72. *
  73. * @param portID ID of the port
  74. * @param blocked address to write the blocked status into
  75. *
  76. * Note that this function is documented in the main component
  77. * header file, IxEthDB.h.
  78. *
  79. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  80. * or an appropriate error message otherwise
  81. */
  82. IX_ETH_DB_PUBLIC
  83. IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked)
  84. {
  85. IX_ETH_DB_CHECK_PORT(portID);
  86. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  87. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL);
  88. IX_ETH_DB_CHECK_REFERENCE(blocked);
  89. *blocked = ixEthDBPortInfo[portID].stpBlocked;
  90. return IX_ETH_DB_SUCCESS;
  91. }