Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 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 | |
| 45 | |
| 46 | #include "IxEthDB_p.h" |
| 47 | |
| 48 | /** |
| 49 | * @brief sets the STP blocking state of a port |
| 50 | * |
| 51 | * @param portID ID of the port |
| 52 | * @param blocked TRUE to block the port or FALSE to unblock it |
| 53 | * |
| 54 | * Note that this function is documented in the main component |
| 55 | * header file, IxEthDB.h. |
| 56 | * |
| 57 | * @return IX_ETH_DB_SUCCESS if the operation completed successfully |
| 58 | * or an appropriate error message otherwise |
| 59 | */ |
| 60 | IX_ETH_DB_PUBLIC |
| 61 | IxEthDBStatus ixEthDBSpanningTreeBlockingStateSet(IxEthDBPortId portID, BOOL blocked) |
| 62 | { |
| 63 | IxNpeMhMessage message; |
| 64 | IX_STATUS result; |
| 65 | |
| 66 | IX_ETH_DB_CHECK_PORT(portID); |
| 67 | |
| 68 | IX_ETH_DB_CHECK_SINGLE_NPE(portID); |
| 69 | |
| 70 | IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL); |
| 71 | |
| 72 | ixEthDBPortInfo[portID].stpBlocked = blocked; |
| 73 | |
| 74 | FILL_SETBLOCKINGSTATE_MSG(message, portID, blocked); |
| 75 | |
| 76 | IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result); |
| 77 | |
| 78 | return result; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @brief retrieves the STP blocking state of a port |
| 83 | * |
| 84 | * @param portID ID of the port |
| 85 | * @param blocked address to write the blocked status into |
| 86 | * |
| 87 | * Note that this function is documented in the main component |
| 88 | * header file, IxEthDB.h. |
| 89 | * |
| 90 | * @return IX_ETH_DB_SUCCESS if the operation completed successfully |
| 91 | * or an appropriate error message otherwise |
| 92 | */ |
| 93 | IX_ETH_DB_PUBLIC |
| 94 | IxEthDBStatus ixEthDBSpanningTreeBlockingStateGet(IxEthDBPortId portID, BOOL *blocked) |
| 95 | { |
| 96 | IX_ETH_DB_CHECK_PORT(portID); |
| 97 | |
| 98 | IX_ETH_DB_CHECK_SINGLE_NPE(portID); |
| 99 | |
| 100 | IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_SPANNING_TREE_PROTOCOL); |
| 101 | |
| 102 | IX_ETH_DB_CHECK_REFERENCE(blocked); |
| 103 | |
| 104 | *blocked = ixEthDBPortInfo[portID].stpBlocked; |
| 105 | |
| 106 | return IX_ETH_DB_SUCCESS; |
| 107 | } |