📄 sctp_defs.h
字号:
/***************************************************************************** @(#) sctp_defs.h,v 0.7.8.1 2001/12/11 13:26:33 brian Exp ----------------------------------------------------------------------------- Copyright (C) 2001 OpenSS7 Corporation <http://www.openss7.com> All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------------- U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software on behalf of the U.S. Government ("Government"), the following provisions apply to you. If the Software is supplied by the Department of Defense ("DoD"), it is classified as "Commercial Computer Software" under paragraph 252.227-7014 of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any successor regulations) and the Government is acquiring only the license rights granted herein (the license rights customarily provided to non-Government users). If the Software is supplied to any unit or agency of the Government other than DoD, it is classified as "Restricted Computer Software" and the Government's rights in the Software are defined in paragraph 52.227-19 of the Federal Acquisition Regulations ("FAR") (or any success regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR (or any successor regulations). ----------------------------------------------------------------------------- Last Modified 2001/12/11 13:26:33 by brian *****************************************************************************/#ifndef __SCTP_DEFS_H__#define __SCTP_DEFS_H__/* * ========================================================================= * * SCTP Message Structures * * ========================================================================= */#ifndef PADC#define PADC(__len) (((__len)+0x3)&~0x3)#endif/* basic headers */struct sctphdr { uint16_t srce; uint16_t dest; uint32_t v_tag; uint32_t check;};struct sctpchdr { uint8_t type; uint8_t flags; uint16_t len;};/* * SCTP Origin Codes (Match with NPI). */#define SCTP_ORIG_PROVIDER 0x0100 /* provider originated reset/disconnect */#define SCTP_ORIG_USER 0x0101 /* user originated reset/disconnect */#define SCTP_ORIG_UNDEFINED 0x0102 /* reset/disconnect originator undefined *//* * SCTP Cause Codes */#define SCTP_CAUSE_FIRST 1#define SCTP_CAUSE_INVALID_STR 1 /* Invalid Stream Identifier */#define SCTP_CAUSE_MISSING_PARM 2 /* Missing Mandatory Parameter */#define SCTP_CAUSE_STALE_COOKIE 3 /* Stale Cookie Error */#define SCTP_CAUSE_NO_RESOURCE 4 /* Out of Resource */#define SCTP_CAUSE_BAD_ADDRESS 5 /* Unresolvable Address */#define SCTP_CAUSE_BAD_CHUNK_TYPE 6 /* Unrecognized Chunk Type */#define SCTP_CAUSE_INVALID_PARM 7 /* Invalid Mandatory Parameter */#define SCTP_CAUSE_BAD_PARM 8 /* Unrecognized Parameters */#define SCTP_CAUSE_NO_DATA 9 /* No User Data */#define SCTP_CAUSE_SHUTDOWN 10 /* Cookie Received While Shutting Down */#define SCTP_CAUSE_LAST 10#define SCTP_CF_INVALID_STR (1<< SCTP_CAUSE_INVALID_STR )#define SCTP_CF_MISSING_PARM (1<< SCTP_CAUSE_MISSING_PARM )#define SCTP_CF_STALE_COOKIE (1<< SCTP_CAUSE_STALE_COOKIE )#define SCTP_CF_NO_RESOURCE (1<< SCTP_CAUSE_NO_RESOURCE )#define SCTP_CF_BAD_ADDRESS (1<< SCTP_CAUSE_BAD_ADDRESS )#define SCTP_CF_BAD_CHUNK_TYPE (1<< SCTP_CAUSE_BAD_CHUNK_TYPE )#define SCTP_CF_INVALID_PARM (1<< SCTP_CAUSE_INVALID_PARM )#define SCTP_CF_BAD_PARM (1<< SCTP_CAUSE_BAD_PARM )#define SCTP_CF_NO_DATA (1<< SCTP_CAUSE_NO_DATA )#define SCTP_CF_SHUTDOWN (1<< SCTP_CAUSE_SHUTDOWN )#define SCTP_CF_MASK_ANY (SCTP_CF_INVALID_STR \ |SCTP_CF_MISSING_PARM \ |SCTP_CF_STALE_COOKIE \ |SCTP_CF_NO_RESOURCE \ |SCTP_CF_BAD_ADDRESS \ |SCTP_CF_BAD_CHUNK_TYPE \ |SCTP_CF_INVALID_PARM \ |SCTP_CF_BAD_PARM \ |SCTP_CF_NO_DATA \ |SCTP_CF_SHUTDOWN )/* * SCTP Cause Code Structures */struct sctpehdr { uint16_t code; uint16_t len;};struct sctp_bad_stri { /* Invalid Stream Identifier */ struct sctpehdr eh; uint16_t sid; /* stream identifier */ uint16_t res; /* reserved */};struct sctp_no_mparm { /* Missing Mandatory Parameter */ struct sctpehdr eh; uint32_t num; /* number of missing parms */ uint16_t mp[0]; /* array of missing parms */};struct sctp_stale_ck { /* Stale Cookie Error */ struct sctpehdr eh; uint32_t staleness; /* measure of staleness (usec) */};struct sctp_no_rsrce { /* Out of Resource */ struct sctpehdr eh;};struct sctp_bad_addr { /* Unresolvable Address */ struct sctpehdr eh; /* followed by */ /* address parameter */};struct sctp_bad_chnk { /* Unrecognized Chunk Type */ struct sctpehdr eh; struct sctpchdr ch; /* header of unrecognized chunk */};struct sctp_bad_parm { /* Invalid Mandatory Parameter */ struct sctpehdr eh;};struct sctp_unk_parm { /* Unrecognized Parameters */ struct sctpehdr eh; unsigned char parm[0];/* unrecognized parameters */};struct sctp_no_udata { /* No user Data */ struct sctpehdr eh; uint32_t tsn; /* tsn of data chunk */};struct sctp_ck_shutd { /* Cookie Received While Shutting Down */ struct sctpehdr eh;};union sctp_cause { struct sctpehdr eh; struct sctp_bad_stri bad_stri; /* Invalid Stream Identifier */ struct sctp_no_mparm no_mparm; /* Missing Mandatory Parameter */ struct sctp_stale_ck stale_ck; /* Stale Cookie Error */ struct sctp_no_rsrce no_rsrce; /* Out of Resource */ struct sctp_bad_addr bad_addr; /* Unresolvable Address */ struct sctp_bad_chnk bad_chnk; /* Unrecognized Chunk Type */ struct sctp_bad_parm bad_parm; /* Invalid Mandatory Parameter */ struct sctp_unk_parm unk_parm; /* Unrecognized Parameters */ struct sctp_no_udata no_udata; /* No user Data */ struct sctp_ck_shutd ck_shutd; /* Cookie Received While Shutting Down */};/* * COOKIE parameter * * TODO: Put IP OPTIONS (struct ip_options + __data) from the INIT message * into the cookie and pull them back out of the COOKIE ECHO. As it stands * now we are only supporting IP OPTIONS with our own INIT. */struct sctp_cookie { unsigned long timestamp; /* timestamp of the cookie */ unsigned long lifespan; /* lifespan of the cookie */ uint32_t v_tag; /* local verification tag */ uint32_t daddr; /* dest address */ uint32_t saddr; /* srce address */ uint16_t dport; /* dest port */ uint16_t sport; /* dest port */ uint32_t p_tag; /* peer's verification tag */ uint32_t p_tsn; /* peer initial TSN */ uint32_t p_rwnd; /* perr a_rwnd */ uint16_t n_istr; /* number of inbound streams */ uint16_t n_ostr; /* number of outbound streams */ uint32_t l_ttag; /* local tie tag */ uint32_t p_ttag; /* peer tie tag */ uint16_t danum; /* number of dest transport addresses */ uint16_t sanum; /* number of srce transport addresses */ uint16_t key_tag; /* sender's tag for key */ uint16_t opt_len; /* length of included ip options */ /* followed by opt.__data */ /* followed by dtas */ /* uint32_t dtas[0]; dest transport addresses */ /* followed by stas */ /* uint32_t stas[0]; srce transport addresses */ /* followed by mac */ /* uint8_t mac[160]; message authentication code */};/* * Our HEARTBEAT INFO structure: */struct sctp_hb_info { unsigned long timestamp; /* jiffies timestamp of when it was sent */ uint32_t daddr; /* destination address sent to */ int mtu; /* Destingation MTU being tested */ unsigned char fill[0]; /* Fill for Destination MTU testing */};/* * SCTP Parameter types */#define SCTP_PTYPE_HEARTBEAT_INFO (__constant_htons(1))#define SCTP_PTYPE_IPV4_ADDR (__constant_htons(5))#define SCTP_PTYPE_IPV6_ADDR (__constant_htons(6))#define SCTP_PTYPE_STATE_COOKIE (__constant_htons(7))#define SCTP_PTYPE_UNREC_PARMS (__constant_htons(8))#define SCTP_PTYPE_COOKIE_PSRV (__constant_htons(9))#define SCTP_PTYPE_HOST_NAME (__constant_htons(11))#define SCTP_PTYPE_ADDR_TYPE (__constant_htons(12))#define SCTP_PTYPE_MASK (__constant_htons(0x3fff))#define SCTP_PTYPE_MASK_CONTINUE (__constant_htons(0x8000))#define SCTP_PTYPE_MASK_REPORT (__constant_htons(0x4000))struct sctpphdr { uint16_t type; uint16_t len;};struct sctp_heartbeat_info { struct sctpphdr ph; struct sctp_hb_info hb_info;};struct sctp_ipv4_addr { struct sctpphdr ph;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -