1 /* Copyright (C) 2011 Open Information Security Foundation 2 * 3 * You can copy, redistribute or modify this Program under the terms of 4 * the GNU General Public License version 2 as published by the Free 5 * Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * version 2 along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 * 02110-1301, USA. 16 */ 17 18 /** 19 * \file 20 * 21 * \author Eric Leblond <eric@regit.org> 22 */ 23 24 #ifndef __DECODE_SCTP_H__ 25 #define __DECODE_SCTP_H__ 26 27 /** size of the packet header without any chunk headers */ 28 #define SCTP_HEADER_LEN 12 29 30 /* XXX RAW* needs to be really 'raw', so no SCNtohs there */ 31 #define SCTP_GET_RAW_SRC_PORT(sctph) SCNtohs((sctph)->sh_sport) 32 #define SCTP_GET_RAW_DST_PORT(sctph) SCNtohs((sctph)->sh_dport) 33 34 #define SCTP_GET_SRC_PORT(p) SCTP_GET_RAW_SRC_PORT(p->sctph) 35 #define SCTP_GET_DST_PORT(p) SCTP_GET_RAW_DST_PORT(p->sctph) 36 37 typedef struct SCTPHdr_ 38 { 39 uint16_t sh_sport; /* source port */ 40 uint16_t sh_dport; /* destination port */ 41 uint32_t sh_vtag; /* verification tag, defined per flow */ 42 uint32_t sh_sum; /* checksum, computed via crc32 */ 43 } __attribute__((__packed__)) SCTPHdr; 44 45 #define CLEAR_SCTP_PACKET(p) { \ 46 (p)->sctph = NULL; \ 47 } while (0) 48 49 void DecodeSCTPRegisterTests(void); 50 51 #endif /* __DECODE_SCTP_H__ */ 52