Deleted Added
full compact
alias_sctp.h (186543) alias_sctp.h (188294)
1/*/* $Id$ */
2//#ifndef lint
3//static char vcid[] = "$Id$";
4//#endif /* lint */
5/**
6 * @file alias_sctp.h
7 * Copyright (c) 2008, Centre for Advanced Internet Architectures
8 * Swinburne University of Technology, Melbourne, Australia
9 * (CRICOS number 00111D).
10 *
1/**
2 * @file alias_sctp.h
3 * Copyright (c) 2008, Centre for Advanced Internet Architectures
4 * Swinburne University of Technology, Melbourne, Australia
5 * (CRICOS number 00111D).
6 *
11 * Alias_sctp forms part of the libalias kernel module to handle
12 * Network Address Translation (NAT) for the SCTP protocol.
13 *
14 * This software was developed by David A. Hayes
15 * with leadership and advice from Jason But
16 *
17 * The design is outlined in CAIA technical report number 080618A
18 * (D. Hayes and J. But, "Alias_sctp Version 0.1: SCTP NAT implementation in IPFW")
19 *
20 * Development is part of the CAIA SONATA project,
21 * proposed by Jason But and Grenville Armitage:
22 * http://caia.swin.edu.au/urp/sonata/
23 *
24 *
25 * This project has been made possible in part by a grant from
26 * the Cisco University Research Program Fund at Community
27 * Foundation Silicon Valley.
28 *
29 *
30 * All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.

--- 9 unchanged lines hidden (view full) ---

49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.

--- 9 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * Alias_sctp forms part of the libalias kernel module to handle
33 * Network Address Translation (NAT) for the SCTP protocol.
34 *
35 * This software was developed by David A. Hayes
36 * with leadership and advice from Jason But
37 *
38 * The design is outlined in CAIA technical report number 080618A
39 * (D. Hayes and J. But, "Alias_sctp Version 0.1: SCTP NAT implementation in IPFW")
40 *
41 * Development is part of the CAIA SONATA project,
42 * proposed by Jason But and Grenville Armitage:
43 * http://caia.swin.edu.au/urp/sonata/
44 *
45 *
46 * This project has been made possible in part by a grant from
47 * the Cisco University Research Program Fund at Community
48 * Foundation Silicon Valley.
49 *
57 */
50 */
51
52/* $FreeBSD: head/sys/netinet/libalias/alias_sctp.h 188294 2009-02-07 18:49:42Z piso $ */
53
58#ifndef _ALIAS_SCTP_H_
59#define _ALIAS_SCTP_H_
60
61#include <sys/param.h>
62#ifdef _KERNEL
63#include <sys/malloc.h>
64#include <sys/module.h>
65#include <sys/kernel.h>

--- 65 unchanged lines hidden (view full) ---

131/**
132 * @brief sctp association information
133 *
134 * Structure that contains information about a particular sctp association
135 * currently under Network Address Translation.
136 * Information is stored in network byte order (as is libalias)***
137 */
138struct sctp_nat_assoc {
54#ifndef _ALIAS_SCTP_H_
55#define _ALIAS_SCTP_H_
56
57#include <sys/param.h>
58#ifdef _KERNEL
59#include <sys/malloc.h>
60#include <sys/module.h>
61#include <sys/kernel.h>

--- 65 unchanged lines hidden (view full) ---

127/**
128 * @brief sctp association information
129 *
130 * Structure that contains information about a particular sctp association
131 * currently under Network Address Translation.
132 * Information is stored in network byte order (as is libalias)***
133 */
134struct sctp_nat_assoc {
139 uint32_t l_vtag; /**< local side verification tag */
140 uint16_t l_port; /**< local side port number */
141 uint32_t g_vtag; /**< global side verification tag */
142 uint16_t g_port; /**< global side port number */
143 struct in_addr l_addr; /**< local ip address */
144 struct in_addr a_addr; /**< alias ip address */
145 int state; /**< current state of NAT association */
146 int TableRegister; /**< stores which look up tables association is registered in */
147 int exp; /**< timer expiration in seconds from uptime */
148 int exp_loc; /**< current location in timer_Q */
149 int num_Gaddr; /**< number of global IP addresses in the list */
150 LIST_HEAD(sctpGlobalAddresshead,sctp_GlobalAddress) Gaddr; /**< List of global addresses */
151 LIST_ENTRY (sctp_nat_assoc) list_L; /**< Linked list of pointers for Local table*/
152 LIST_ENTRY (sctp_nat_assoc) list_G; /**< Linked list of pointers for Global table */
153 LIST_ENTRY (sctp_nat_assoc) timer_Q; /**< Linked list of pointers for timer Q */
135 uint32_t l_vtag; /**< local side verification tag */
136 uint16_t l_port; /**< local side port number */
137 uint32_t g_vtag; /**< global side verification tag */
138 uint16_t g_port; /**< global side port number */
139 struct in_addr l_addr; /**< local ip address */
140 struct in_addr a_addr; /**< alias ip address */
141 int state; /**< current state of NAT association */
142 int TableRegister; /**< stores which look up tables association is registered in */
143 int exp; /**< timer expiration in seconds from uptime */
144 int exp_loc; /**< current location in timer_Q */
145 int num_Gaddr; /**< number of global IP addresses in the list */
146 LIST_HEAD(sctpGlobalAddresshead,sctp_GlobalAddress) Gaddr; /**< List of global addresses */
147 LIST_ENTRY (sctp_nat_assoc) list_L; /**< Linked list of pointers for Local table*/
148 LIST_ENTRY (sctp_nat_assoc) list_G; /**< Linked list of pointers for Global table */
149 LIST_ENTRY (sctp_nat_assoc) timer_Q; /**< Linked list of pointers for timer Q */
154//Using libalias locking
155};
156
157struct sctp_GlobalAddress {
150//Using libalias locking
151};
152
153struct sctp_GlobalAddress {
158 struct in_addr g_addr;
159 LIST_ENTRY (sctp_GlobalAddress) list_Gaddr; /**< Linked list of pointers for Global table */
154 struct in_addr g_addr;
155 LIST_ENTRY (sctp_GlobalAddress) list_Gaddr; /**< Linked list of pointers for Global table */
160};
161
162/**
163 * @brief SCTP chunk of interest
164 *
165 * The only chunks whose contents are of any interest are the INIT and ASCONF_AddIP
166 */
167union sctpChunkOfInt {
156};
157
158/**
159 * @brief SCTP chunk of interest
160 *
161 * The only chunks whose contents are of any interest are the INIT and ASCONF_AddIP
162 */
163union sctpChunkOfInt {
168 struct sctp_init *Init; /**< Pointer to Init Chunk */
169 struct sctp_init_ack *InitAck; /**< Pointer to Init Chunk */
170 struct sctp_paramhdr *Asconf; /**< Pointer to ASCONF chunk */
164 struct sctp_init *Init; /**< Pointer to Init Chunk */
165 struct sctp_init_ack *InitAck; /**< Pointer to Init Chunk */
166 struct sctp_paramhdr *Asconf; /**< Pointer to ASCONF chunk */
171};
172
173
174/**
175 * @brief SCTP message
176 *
177 * Structure containing the relevant information from the SCTP message
178 */
179struct sctp_nat_msg {
167};
168
169
170/**
171 * @brief SCTP message
172 *
173 * Structure containing the relevant information from the SCTP message
174 */
175struct sctp_nat_msg {
180 uint16_t msg; /**< one of the key messages defined above */
176 uint16_t msg; /**< one of the key messages defined above */
181#ifdef INET6
177#ifdef INET6
182 // struct ip6_hdr *ip_hdr; /**< pointer to ip packet header */ /*no inet6 support yet*/
178 // struct ip6_hdr *ip_hdr; /**< pointer to ip packet header */ /*no inet6 support yet*/
183#else
179#else
184 struct ip *ip_hdr; /**< pointer to ip packet header */
180 struct ip *ip_hdr; /**< pointer to ip packet header */
185#endif //#ifdef INET6
181#endif //#ifdef INET6
186 struct sctphdr *sctp_hdr; /**< pointer to sctp common header */
187 union sctpChunkOfInt sctpchnk; /**< union of pointers to the chunk of interest */
188 int chunk_length; /**< length of chunk of interest */
182 struct sctphdr *sctp_hdr; /**< pointer to sctp common header */
183 union sctpChunkOfInt sctpchnk; /**< union of pointers to the chunk of interest */
184 int chunk_length; /**< length of chunk of interest */
189};
190
191
192/**
193 * @brief sctp nat timer queue structure
194 *
195 */
196
197struct sctp_nat_timer {
185};
186
187
188/**
189 * @brief sctp nat timer queue structure
190 *
191 */
192
193struct sctp_nat_timer {
198 int loc_time; /**< time in seconds for the current location in the queue */
199 int cur_loc; /**< index of the current location in the circular queue */
200 LIST_HEAD(sctpTimerQ,sctp_nat_assoc) *TimerQ; /**< List of associations at this position in the timer Q */
194 int loc_time; /**< time in seconds for the current location in the queue */
195 int cur_loc; /**< index of the current location in the circular queue */
196 LIST_HEAD(sctpTimerQ,sctp_nat_assoc) *TimerQ; /**< List of associations at this position in the timer Q */
201};
202
203
204
205#endif //#ifndef _ALIAS_SCTP_H
197};
198
199
200
201#endif //#ifndef _ALIAS_SCTP_H