| 1 | /****************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2007 |
| 4 | Infineon Technologies AG |
| 5 | Am Campeon 1-12; 81726 Munich, Germany |
| 6 | |
| 7 | THE DELIVERY OF THIS SOFTWARE AS WELL AS THE HEREBY GRANTED NON-EXCLUSIVE, |
| 8 | WORLDWIDE LICENSE TO USE, COPY, MODIFY, DISTRIBUTE AND SUBLICENSE THIS |
| 9 | SOFTWARE IS FREE OF CHARGE. |
| 10 | |
| 11 | THE LICENSED SOFTWARE IS PROVIDED "AS IS" AND INFINEON EXPRESSLY DISCLAIMS |
| 12 | ALL REPRESENTATIONS AND WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING |
| 13 | WITHOUT LIMITATION, WARRANTIES OR REPRESENTATIONS OF WORKMANSHIP, |
| 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, DURABILITY, THAT THE |
| 15 | OPERATING OF THE LICENSED SOFTWARE WILL BE ERROR FREE OR FREE OF ANY THIRD |
| 16 | PARTY CLAIMS, INCLUDING WITHOUT LIMITATION CLAIMS OF THIRD PARTY INTELLECTUAL |
| 17 | PROPERTY INFRINGEMENT. |
| 18 | |
| 19 | EXCEPT FOR ANY LIABILITY DUE TO WILFUL ACTS OR GROSS NEGLIGENCE AND EXCEPT |
| 20 | FOR ANY PERSONAL INJURY INFINEON SHALL IN NO EVENT BE LIABLE FOR ANY CLAIM |
| 21 | OR DAMAGES OF ANY KIND, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | DEALINGS IN THE SOFTWARE. |
| 24 | *******************************************************************************/ |
| 25 | #ifndef _SVIP_NAT_IO_H_ |
| 26 | #define _SVIP_NAT_IO_H_ |
| 27 | |
| 28 | #include <asm/ioctl.h> |
| 29 | |
| 30 | #define SVIP_NAT_DEVICE_NAME "svip_nat" |
| 31 | #define PATH_SVIP_NAT_DEVICE_NAME "/dev/"SVIP_NAT_DEVICE_NAME |
| 32 | |
| 33 | #define MAJOR_NUM_SVIP_NAT 10 |
| 34 | #define MINOR_NUM_SVIP_NAT 120 |
| 35 | |
| 36 | /** maximum SVIP devices supported on a Line card system */ |
| 37 | #define SVIP_SYS_NUM 12 |
| 38 | |
| 39 | /** maximum voice packet channels possible per SVIP device */ |
| 40 | #define SVIP_CODEC_NUM 16 |
| 41 | |
| 42 | /** start UDP port number of the SVIP Linecard System */ |
| 43 | #define SVIP_UDP_FROM 50000 |
| 44 | |
| 45 | /** @defgroup SVIP_NATAPI SVIP Custom NAT ioctl interface. |
| 46 | An ioctl interface is provided to add a rule into the SVIP NAT table and |
| 47 | to respectively remove the rule form it. The ioctl interface is accessible |
| 48 | using the fd issued upon opening the special device node /dev/svip_nat. |
| 49 | @{ */ |
| 50 | |
| 51 | /** Used to add a new rule to the SVIP Custom NAT table. If a rule already |
| 52 | exists for the target UDP port, that rule shall be overwritten. |
| 53 | |
| 54 | \param SVIP_NAT_IO_Rule_t* The parameter points to a |
| 55 | \ref SVIP_NAT_IO_Rule_t structure. |
| 56 | */ |
| 57 | #define FIO_SVIP_NAT_RULE_ADD \ |
| 58 | _IOW(MAJOR_NUM_SVIP_NAT, 1, SVIP_NAT_IO_Rule_t) |
| 59 | |
| 60 | /** Used to remove a rule from the SVIP Custom NAT table. No check is |
| 61 | performed whether the rule already exists or not. The remove operation is |
| 62 | performed as long as the target UDP port is within the defined port range. |
| 63 | |
| 64 | \param SVIP_NAT_IO_Rule_t* The parameter points to a |
| 65 | \ref SVIP_NAT_IO_Rule_t structure. |
| 66 | */ |
| 67 | #define FIO_SVIP_NAT_RULE_REMOVE \ |
| 68 | _IOW(MAJOR_NUM_SVIP_NAT, 2, SVIP_NAT_IO_Rule_t) |
| 69 | |
| 70 | /** Used to list all rules in the SVIP Custom NAT table. |
| 71 | |
| 72 | \param <none> |
| 73 | */ |
| 74 | #define FIO_SVIP_NAT_RULE_LIST \ |
| 75 | _IO(MAJOR_NUM_SVIP_NAT, 3) |
| 76 | |
| 77 | /** IP address in network-byte order */ |
| 78 | typedef u32 SVIP_IP_ADDR_t; |
| 79 | /** UDP port in network-byte order */ |
| 80 | typedef u16 SVIP_UDP_PORT_t; |
| 81 | |
| 82 | #ifndef ETH_ALEN |
| 83 | #define ETH_ALEN 6 /* Octets in one ethernet address */ |
| 84 | #endif |
| 85 | |
| 86 | /** NAT parameters part of the NAT table. |
| 87 | These paramters are configurable through the NAT API. */ |
| 88 | typedef struct SVIP_NAT_IO_Rule |
| 89 | { |
| 90 | /** Remote peer, IP address */ |
| 91 | SVIP_IP_ADDR_t remIP; |
| 92 | /** Remote peer, MAC address */ |
| 93 | u8 remMAC[ETH_ALEN]; |
| 94 | /** Target SVIP, IP address (local peer) */ |
| 95 | SVIP_IP_ADDR_t locIP; |
| 96 | /** Target SVIP, MAC address */ |
| 97 | u8 locMAC[ETH_ALEN]; |
| 98 | /** Target SVIP, UDP port number */ |
| 99 | SVIP_UDP_PORT_t locUDP; |
| 100 | } SVIP_NAT_IO_Rule_t; |
| 101 | |
| 102 | /** @} */ |
| 103 | #endif |
| 104 | |