/* ipmip4_msgext.h - ipmip4_msgext.h */ /* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_msgext.h,v $ $Revision: 1.15.2.1 $ * $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_msgext.h,v $ * $Author: svc-cmnet $ $Date: 2013-03-13 07:45:31 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ #ifndef IPMIP4_MSGEXT_H #define IPMIP4_MSGEXT_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** * Base class containing defintions and methods to parse MIP4 registration * requests and icmp advertisements. */ /* DESCRIPTION Base class containing defintions and methods to parse MIP4 registration requests, options and icmp advertisements. EXAMPLE .CS void my_parse_request(struct Ipmip4_my_context *ctx, Ipmip_proc_t *proc, Ipmip4_pktbuf_t *pbuf) { /@ Parse the registration request and locate all the various extensions provided with it @/ pbuf->ext.mobile.result = ipmip4_msgext_mobile_parse_ext(&ctx->ipmip4, proc, pbuf, IPMIP4_REGREQ_LENGTH); switch (pbuf->ext.mobile.result) { case IPMIP4_REG_EXT_FAILED_AUTH: /@ Bad or duplicate Authentication Extensions @/ return; case IPMIP4_REG_EXT_POORLY_FORMED: /@ A badly foormed extension was located in the frame @/ return; case IPMIP4_REG_EXT_DISCARD: /@ The parse code decided to discard this request. Usually this occurs when an unknown non-skippable extension is located @/ return; } } .CE */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include #include #include #include #include "ipmip4_vendor_ext.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* general reply codes. */ #define IPMIP4_CODE_REP_REG_ACCEPTED 0 /* OK: 0=supports multiple bindings */ #define IPMIP4_CODE_REP_REG_ACCEPTED_BUT_NO_SIM_BINDS 1 /* 1=not (1 only used during non-dereg register reply when we can't support the request of multiple bindings. */ /* rfc3344 reply codes used by foreign agent */ #define IPMIP4_CODE_REP_FA_REASON_UNSPECIFIED 64 /* reason unspecified [RFC3344] */ #define IPMIP4_CODE_REP_FA_ADMIN_PROHIBIT 65 /* administratively prohibited [RFC3344] */ #define IPMIP4_CODE_REP_FA_INSUFFICIENT_RESOURCES 66 /* insufficient resources [RFC3344] */ #define IPMIP4_CODE_REP_FA_MN_FAILED_AUTH 67 /* mobile node failed authentication [RFC3344,RFC3012] */ #define IPMIP4_CODE_REP_FA_HA_FAILED_AUTH 68 /* home agent failed authentication [RFC3344] */ #define IPMIP4_CODE_REP_FA_LIFETIME_TOO_LONG 69 /* requested Lifetime too long [RFC3344] */ #define IPMIP4_CODE_REP_FA_POORLY_FORMED_REQUEST 70 /* poorly formed Request [RFC3344] */ #define IPMIP4_CODE_REP_FA_POORLY_FORMED_REPLY 71 /* poorly formed Reply [RFC3344] */ #define IPMIP4_CODE_REP_FA_ENCAP_UNAVAIL 72 /* requested encapsulation unavailable [RFC3344] */ #define IPMIP4_CODE_REP_FA_RESERVED_UNAVAIL 73 /* reserved and unavailable [RFC3344] */ #define IPMIP4_CODE_REP_FA_REV_TUNNEL_UNAVAIL 74 /* request reverse tunnel unavailable [RFC3024] */ #define IPMIP4_CODE_REP_FA_REV_TUNNEL_MANDATORY 75 /* reverse runnel is mandatory and 'T' bit not set [RFC3024] */ #define IPMIP4_CODE_REP_FA_MN_TOO_DISTANT 76 /* mobile node too distant [RFC3024] */ #define IPMIP4_CODE_REP_FA_INVALID_CAREOF_ADDRESS 77 /* invalid care-of address [RFC3344] */ #define IPMIP4_CODE_REP_FA_REG_TIMEOUT 78 /* registration timeout [RFC3344] */ #define IPMIP4_CODE_REP_FA_DELIVERY_UNAVAIL 79 /* delivery style not supported [RFC3024] */ #define IPMIP4_CODE_REP_FA_HOME_NET_UNREACH 80 /* home network unreachable (ICMP error received) [RFC3344] */ #define IPMIP4_CODE_REP_FA_HOME_AGENT_UNREACH 81 /* home agent host unreachable (ICMP error received) [RFC3344] */ #define IPMIP4_CODE_REP_FA_HOME_AGENT_PORT_UNREACH 82 /* home agent port unreachable (ICMP error received) [RFC3344] */ #define IPMIP4_CODE_REP_FA_HOME_AGENT_ERROR 88 /* home agent unreachable (other ICMP error received) [RFC3344] */ #define IPMIP4_CODE_REP_FA_VENDOR_SPECIFIC 89 /* vendor-specific reason [Quick] */ #define IPMIP4_CODE_REP_FA_NONZERO_HOMEADDR_REQ 96 /* nonzero_homeaddr_reqd [RFC2794] */ #define IPMIP4_CODE_REP_FA_MISSING_NAI 97 /* missing_nai [RFC2794] */ #define IPMIP4_CODE_REP_FA_MISSING_HOME_AGENT 98 /* missing_home_agent [RFC2794] */ #define IPMIP4_CODE_REP_FA_MISSING_HOME_ADDRESS 99 /* missing_homeaddr [RFC2794] */ #define IPMIP4_CODE_REP_FA_ERROR_FA_1 100 /* ERROR-FA-1 [RFC3115] */ #define IPMIP4_CODE_REP_FA_ERROR_FA_2 101 /* ERROR-FA-2 [RFC3115] */ #define IPMIP4_CODE_REP_FA_UNKNOWN_CHALLENGE 104 /* unknown_challenge [RFC3012] */ #define IPMIP4_CODE_REP_FA_MISSING_CHALLENGE 105 /* missing_challenge [RFC3012] */ #define IPMIP4_CODE_REP_FA_STALE_CHALLENGE 106 /* stale_challenge [RFC3012] */ #define IPMIP4_CODE_REP_FA_MISSING_MN_FA 107 /* MISSING_MN_FA [RFC3957] */ #define IPMIP4_CODE_REP_FA_BAD_AAA_AUTH 108 /* fa_bad_aaa_auth [RFC4721] */ #define IPMIP4_CODE_REP_FA_HA_WRONG_CHALLENGE 109 /* wrong_challenge [RFC4721] */ #define IPMIP4_CODE_REP_FA_EXPERIMENTAL 127 /* FA Error Code for Experimental use [RFC4064] */ #define IPMIP4_CODE_REP_FA(code) ((code) <= 8 || ((code) >= 64 && (code) < 128)) /* reply codes for registration denied by home agent. */ #define IPMIP4_CODE_REP_HA_REASON_UNSPECIFIED 128 #define IPMIP4_CODE_REP_HA_ADMIN_PROHIBIT 129 #define IPMIP4_CODE_REP_HA_INSUFFICIENT_RESOURCES 130 #define IPMIP4_CODE_REP_HA_MN_FAILED_AUTH 131 #define IPMIP4_CODE_REP_HA_FA_FAILED_AUTH 132 #define IPMIP4_CODE_REP_HA_REG_ID_MISMATCH 133 #define IPMIP4_CODE_REP_HA_POORLY_FORMED_REQUEST 134 #define IPMIP4_CODE_REP_HA_TOO_MANY_SIM 135 #define IPMIP4_CODE_REP_HA_UNKNOWN_HOME_AGENT_ADDR 136 /* unknown home agent address [RFC3344] */ /* rfc2344 HA codes: */ #define IPMIP4_CODE_REP_HA_REV_TUNNEL_UNAVAIL 137 /* request reverse tunnel unavailable [RFC3024] */ #define IPMIP4_CODE_REP_HA_REV_TUNNEL_MANDATORY 138 /* reverse runnel is mandatory and 'T' bit not set [RFC3024] */ #define IPMIP4_CODE_REP_HA_ENCAP_UNAVAIL 139 /* requested encapsulation unavailable [RFC3024] */ #define IPMIP4_CODE_REP_HA_ERROR_HA_1 140 /* ERROR-HA-1 [RFC3115] */ #define IPMIP4_CODE_REP_HA_ERROR_HA_2 141 /* ERROR-HA-2 [RFC3115] */ #define IPMIP4_CODE_REP_HA_UDP_ENCAP_UNAVAIL 142 /* ERROR_HA_UDP-ENCAP_UNAVAIL [RFC3519] */ #define IPMIP4_CODE_REP_HA_REGISTER_REDIRECTED 143 /* Reregister with redirected HA [RFC4433] */ #define IPMIP4_CODE_REP_HA_BAD_AAA_AUTH 144 /* ha_bad_aaa_auth [RFC4721] */ /* rfc5177 HA codes: */ #define IPMIP4_CODE_REP_HA_MOBNET_ERROR 147 /* Mobile Network Prefix operation error (HA_MOBNET_ERROR) [RFC5177]*/ #define IPMIP4_CODE_REP_HA_MOBNET_DISALLOWED 148 /* Mobile Router operation is not permitted (HA_MOBNET_DISALLOWED) [RFC5177]*/ #define IPMIP4_CODE_REP_HA_EXPERIMENTAL 192 /* HA Error Code for Experimental use [RFC4064] */ #define IPMIP4_CODE_REP_FA_INVALID_HOME_AGENT_ADDRESS 194 /* FA does not serve MN as HA */ #define IPMIP4_CODE_REP_HA(code) ((code) <= 8 || ((code) >= 128)) /* Known extensions */ #define IPMIP4_EXT_TYPE_MOBILE_HOME_AUTH 32 #define IPMIP4_EXT_TYPE_MOBILE_FOREIGN_AUTH 33 #define IPMIP4_EXT_TYPE_FOREIGN_HOME_AUTH 34 #define IPMIP4_EXT_TYPE_FOREIGN_FOREIGN_AUTH 35 #define IPMIP4_EXT_TYPE_GENERIC_AUTH 36 #define IPMIP4_EXT_TYPE_CVSE 38 #define IPMIP4_EXT_TYPE_MN_FA_KEYGEN_REQ 40 #define IPMIP4_EXT_TYPE_MN_FA_KEYGEN_REP 41 #define IPMIP4_EXT_TYPE_MN_HA_KEYGEN_REQ 42 #define IPMIP4_EXT_TYPE_MN_HA_KEYGEN_REP 43 #define IPMIP4_EXT_TYPE_UDP_TUNNEL_REP 44 #define IPMIP4_EXT_TYPE_FA_ERROR 45 #define IPMIP4_EXT_TYPE_PMIPV4_NON_SKIPPABLE 47 #define IPMIP4_EXT_TYPE_NAI_MOBILE 131 #define IPMIP4_EXT_TYPE_AGENT_ADV_CHALLENGE 132 #define IPMIP4_EXT_TYPE_NVSE 134 #define IPMIP4_EXT_TYPE_NAI_AGENT 136 #define IPMIP4_EXT_TYPE_REVOCATION 137 #define IPMIP4_EXT_TYPE_LLA 138 #define IPMIP4_EXT_TYPE_DYNAMIC_HA 139 #define IPMIP4_EXT_TYPE_UDP_TUNNEL_REQ 144 #define IPMIP4_EXT_TYPE_PMIPV4 147 #define IPMIP4_EXT_TYPE_MOBNET 148 # define IPMIP4_MOBNET_SUBTYPE_REGISTRATION 0 # define IPMIP4_MOBNET_SUBTYPE_ACK_EXPLICIT 1 # define IPMIP4_MOBNET_SUBTYPE_ACK_IMPLICIT 2 # define IPMIP4_MOBNET_SUCCESS 0 # define IPMIP4_MOBNET_INVALID_PREFIX_LEN 1 # define IPMIP4_MOBNET_UNAUTHORIZED 2 # define IPMIP4_MOBNET_FWDING_SETUP_FAILED 3 #define IPMIP4_PMIPV4_SUBTYPE_PER_NODE_AUTH_METHOD 1 # define IPMIP4_PMIPV4_AUTH_TYPE_METHOD_FA_HA 1 # define IPMIP4_PMIPV4_AUTH_TYPE_METHOD_IPSEC 2 #define IPMIP4_PMIPV4_SUBTYPE_INTERFACE_ID 1 #define IPMIP4_PMIPV4_SUBTYPE_DEVICE_ID 2 # define IPMIP4_PMIPV4_DEVICE_ID_ETH 1 # define IPMIP4_PMIPV4_DEVICE_ID_MEID 2 # define IPMIP4_PMIPV4_DEVICE_ID_IMEI 3 # define IPMIP4_PMIPV4_DEVICE_ID_ESN 4 #define IPMIP4_PMIPV4_SUBTYPE_SUBSCRIBER_ID 3 # define IPMIP4_PMIPV4_SUBSCRIBER_ID_IMSI 1 #define IPMIP4_PMIPV4_SUBTYPE_ACCESS_TYPE 4 # define IPMIP4_PMIPV4_ACCESS_TYPE_802_3 1 # define IPMIP4_PMIPV4_ACCESS_TYPE_802_11ABG 2 # define IPMIP4_PMIPV4_ACCESS_TYPE_802_16E 3 # define IPMIP4_PMIPV4_ACCESS_TYPE_802_16M 4 # define IPMIP4_PMIPV4_ACCESS_TYPE_3GPP_EUTRAN_LTE 5 # define IPMIP4_PMIPV4_ACCESS_TYPE_3GPP_UTRAN_GERAN 6 # define IPMIP4_PMIPV4_ACCESS_TYPE_3GPP2_1XRTT_HRPD 7 # define IPMIP4_PMIPV4_ACCESS_TYPE_3GPP2_UMB 8 #define IPMIP4_NAI_SUBTYPE_HA 1 #define IPMIP4_NAI_SUBTYPE_AAAH 2 #define IPMIP4_EXT_GENERIC_AUTH_SUBTYPE_MN_AAA 1 #define IPMIP4_FA_ERROR_SUBTYPE_0 0 #define IPMIP4_KEYGEN_SUBTYPE_1 1 #define IPMIP4_DYNAMIC_HA_SUBTYPE_REQUESTED 1 #define IPMIP4_DYNAMIC_HA_SUBTYPE_REDIRECTED 2 /* Reg codes: */ #define IPMIP4_CODE_REQ_SIM_BINDINGS 0x80 #define IPMIP4_CODE_REQ_BROADCAST 0x40 #define IPMIP4_CODE_REQ_DECAPSULATION 0x20 /* use co-located address (no foreign agent). */ #define IPMIP4_CODE_REQ_MINIMAL_ENC 0x10 #define IPMIP4_CODE_REQ_GRE_ENC 0x08 #define IPMIP4_CODE_REQ_RESERVED1 0x04 #define IPMIP4_CODE_REQ_REVERSE_TUNNELING 0x02 #define IPMIP4_CODE_REQ_RESERVED0 0x01 #define IPMIP4_MSGEXT_MAX_EXTENSIONS 6 #define IPMIP4_MSGEXT_SHDR_HDR_SIZE 2 #define IPMIP4_MSGEXT_LHDR_HDR_SIZE 4 #define IPMIP4_MSGEXT_UHDR_TYPE(uhdr) (((Ipmip4_msgext_uhdr_t *)uhdr)->shdr.type) #define IPMIP4_MSGEXT_SHDR_EXT_DATA(uhdr) (((Ip_u8 *)(uhdr)) + IPMIP4_MSGEXT_SHDR_HDR_SIZE) #define IPMIP4_MSGEXT_SHDR_EXT_SIZE(uhdr) (((Ipmip4_msgext_uhdr_t *)uhdr)->shdr.length) #define IPMIP4_MSGEXT_SHDR_TOT_SIZE(uhdr) (IPMIP4_MSGEXT_SHDR_EXT_SIZE(uhdr) + IPMIP4_MSGEXT_SHDR_HDR_SIZE) #define IPMIP4_MSGEXT_LHDR_EXT_DATA(uhdr) (((Ip_u8 *)(uhdr)) + IPMIP4_MSGEXT_LHDR_HDR_SIZE) #define IPMIP4_MSGEXT_LHDR_EXT_SIZE(uhdr) (IP_GET_NTOHS(&((Ipmip4_msgext_uhdr_t *)uhdr)->lhdr.length)) #define IPMIP4_MSGEXT_LHDR_TOT_SIZE(uhdr) (IPMIP4_MSGEXT_LHDR_EXT_SIZE(uhdr) + IPMIP4_MSGEXT_LHDR_HDR_SIZE) #define IPMIP4_MSGEXT_LHDR_SUBTYPE(uhdr) (((Ipmip4_msgext_uhdr_t *)uhdr)->lhdr.subtype) #define IPMIP4_MSGEXT_VSE_HEADER (6) #define IPMIP4_MSGEXT_NVSE_EXT_DATA(uhdr) (((Ip_u8 *)IPMIP4_MSGEXT_SHDR_EXT_DATA(uhdr)) + IPMIP4_MSGEXT_VSE_HEADER) #define IPMIP4_MSGEXT_NVSE_EXT_SIZE(uhdr) (IPMIP4_MSGEXT_SHDR_EXT_SIZE(uhdr) - IPMIP4_MSGEXT_VSE_HEADER) #define IPMIP4_MSGEXT_CVSE_EXT_DATA(uhdr) (((Ip_u8 *)IPMIP4_MSGEXT_LHDR_EXT_DATA(uhdr)) + IPMIP4_MSGEXT_VSE_HEADER) #define IPMIP4_MSGEXT_CVSE_EXT_SIZE(uhdr) (IPMIP4_MSGEXT_LHDR_EXT_SIZE(uhdr) - IPMIP4_MSGEXT_VSE_HEADER) #define IPMIP4_MSGEXT_AUTHENTICATED(uhdr, uauth) ((Ip_u8 *)(uhdr) <= (Ip_u8 *)(uauth)? IP_TRUE : IP_FALSE) /* ICMP types: */ #define IPMIP4_ICMP_AGENT_ADVERTISEMENT 9 #define IPMIP4_ICMP_ROUTER_SOLICITATION 10 /* ICMP codes: */ #define IPMIP4_ICMP_CODE_GENERIC_ROUTER 0 #define IPMIP4_ICMP_CODE_AGENT_ONLY 16 /* ICMP extentions */ #define IPMIP4_ICMP_EXT_TYPE_MOBILITY_AGENT_ADV 16 #define IPMIP4_ICMP_EXT_TYPE_AGENT_ADV_CHALLENGE 24 #define IPMIP4_ICMP_EXT_TYPE_NAI_AGENT 136 #define IPMIP4_ICMP_EXT_TYPE_LLA 140 /* Return codes when parsing Reg extensions */ #define IPMIP4_REG_EXT_UNKNOWN_VSE (1) #define IPMIP4_REG_EXT_SUCCESS (0) #define IPMIP4_REG_EXT_POORLY_FORMED (-1) #define IPMIP4_REG_EXT_FAILED_AUTH (-2) #define IPMIP4_REG_EXT_DISCARD (-3) #define IPMIP4_TYPE_REG_NAT_ENCAP 4 /* **************************************************************************** * 5 TYPES **************************************************************************** */ typedef struct Ipmip4_icmp_ext_lla_struct { Ip_u8 type; /* IPMIP4_ICMP_EXT_TYPE_LLA */ Ip_u8 length; /* 1 + len(identifier) = 7 in mac case */ Ip_u8 subtype; /* IPMIP4_LLA_SUBTYPE_MAC */ Ip_u8 lla[1]; } Ipmip4_icmp_lla_ext_t; #include /* *=========================================================================== * Foreign agent advertisement (ICMP) *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_icmp_advert { Ip_u8 icmp_type; /* 9 = IPMIPFA_ICMP_TYPE_ADV */ Ip_u8 icmp_code; /* 16 = IPMIPFA_ICMP_CODE_AGENT_ONLY * 0 = IPMIPFA_ICMP_CODE_GENERIC_ROUTER * Act agent only for mobile nodes, * no generic routing. */ Ip_u16 icmp_checksum; /* Set to 0 then calc */ Ip_u8 adv_num_addrs; /* [0..] */ Ip_u8 adv_addr_entry_size; /* 2 (anything non-zero) */ Ip_u16 adv_lifetime; /* Router addresses and preference levels are skipped for mobile agents */ } IP_PACKED2 Ipmip4_icmp_advert_t; typedef struct IP_PACKED1 Ipmip4_icmp_advrt { Ip_u32 address; Ip_u32 pref_level; } IP_PACKED2 Ipmip4_icmp_advrt_t; /* *=========================================================================== * Foreign agent solicitation (ICMP) *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_icmp_solicit { Ip_u8 icmp_type; Ip_u8 icmp_code; Ip_u16 icmp_checksum; Ip_u32 icmp_reserved; } IP_PACKED2 Ipmip4_icmp_solicit_t; /* *=========================================================================== * Ipmip4_icmp_ext_advert *=========================================================================== * The Mobility Agent Advertisement Extension follows the ICMP Router * Advertisement fields. It is used to indicate that an ICMP Router * Advertisement message is also an Agent Advertisement being sent by * a mobility agent. */ typedef struct IP_PACKED1 Ipmip4_icmp_ext_advert { Ip_u8 type; /* IPMIPFA_ICMP_EXT_TYPE_MOBILITY_AGENT_ADV */ Ip_u8 length; /* 6 + 4*N (N=number of care-of addresses) */ Ip_u16 seq; /* init to 0 */ Ip_u16 reg_lifetime; /* willing regtime, 0xffff = infinite */ Ip_u16 flags; /* IPMIPFA_ADVEXT_FLAG_xxx */ Ip_u32 coa[1]; /* One or more care-of-addresses */ } IP_PACKED2 Ipmip4_icmp_ext_advert_t; /* Registration required. Registration with this foreign agent (or another foreign agent on this link) is required even when using a co-located care-of address.*/ #define IPMIP4_ICMP_ADVEXT_FLAG_REG_REQUIRED (1 << 15) /* Busy. The foreign agent will not accept registrations from additional mobile nodes. */ #define IPMIP4_ICMP_ADVEXT_FLAG_BUSY (1 << 14) /* Home agent. This agent offers service as a home agent on the link on which this Agent Advertisement message is sent.*/ #define IPMIP4_ICMP_ADVEXT_FLAG_HOME_AGENT (1 << 13) /* Foreign agent. This agent offers service as a foreign agent on the link on which this Agent Advertisement message is sent. */ #define IPMIP4_ICMP_ADVEXT_FLAG_FOREIGN_AGENT (1 << 12) /* Minimal encapsulation. This agent implements receiving tunneled datagrams that use minimal encapsulation */ #define IPMIP4_ICMP_ADVEXT_FLAG_MINIMAL_ENCAP (1 << 11) /* GRE encapsulation. This agent implements receiving tunneled datagrams that use GRE encapsulation */ #define IPMIP4_ICMP_ADVEXT_FLAG_GRE_ENCAP (1 << 10) /* Sent as zero; ignored on reception. */ #define IPMIP4_ICMP_ADVEXT_FLAG_RESERVED (1 << 9) /* Foreign agent supports reverse tunneling */ #define IPMIP4_ICMP_ADVEXT_FLAG_REV_TUNNEL (1 << 8) /* UDP Tunneling supported */ #define IPMIP4_ICMP_ADVEXT_FLAG_UDP_TUNNELING (1 << 7) /* Registration Revocation */ #define IPMIP4_ICMP_ADVEXT_FLAG_REVOCATION (1 << 6) /* *=========================================================================== * Registration request and reply *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_regreq { Ip_u8 type; Ip_u8 code; Ip_u16 lifetime; Ip_u32 home_addr; Ip_u32 home_agent; Ip_u32 care_of_addr; Ip_u32 id[2]; } IP_PACKED2 Ipmip4_regreq_t; #define IPMIP4_TYPE_REG_REQUEST 1 #define IPMIP4_REGREQ_LENGTH 24 typedef struct IP_PACKED1 Ipmip4_regrep { Ip_u8 type; Ip_u8 code; Ip_u16 lifetime; Ip_u32 home_addr; Ip_u32 home_agent; Ip_u32 id[2]; } IP_PACKED2 Ipmip4_regrep_t; #define IPMIP4_TYPE_REG_REPLY 3 #define IPMIP4_REGREP_LENGTH 20 typedef struct IP_PACKED1 Ipmip4_hrqst { Ip_u8 type; Ip_u8 flags; Ip_u16 reserved1; Ip_u16 lifetime; Ip_u16 reserved2; Ip_u32 home_addr; Ip_u32 home_agent; Ip_u32 id[2]; } IP_PACKED2 Ipmip4_hrqst_t; typedef struct IP_PACKED1 Ipmip4_hrply { Ip_u8 type; Ip_u8 flags; Ip_u8 reserved1; Ip_u8 code; Ip_u16 lifetime; Ip_u16 reserved2; Ip_u32 home_addr; Ip_u32 home_agent; Ip_u32 id[2]; } IP_PACKED2 Ipmip4_hrply_t; #define IPMIP4_TYPE_REG_HRQST 16 #define IPMIP4_TYPE_REG_HRPLY 17 #define IPMIP4_FLAG_REG_HRQST_L2_ST 0x80 #define IPMIP4_FLAG_REG_HRQST_L2_TT 0x40 #define IPMIP4_FLAG_REG_HRQST_RENEW 0x20 #define IPMIP4_FLAG_REG_HRQST_MINIMAL_ENC 0x10 #define IPMIP4_FLAG_REG_HRQST_GRE_ENC 0x08 #define IPMIP4_FLAG_REG_HRQST_REVERSE_TUNNELING 0x04 #define IPMIP4_FLAG_REG_HRQST_SHOULD_TUNNEL 0x02 #define IPMIP4_FLAG_REG_HRQST_RESERVED0 0x01 #define IPMIP4_FLAG_REG_HRQST_L2_HTT (0x80|0x40) #define IPMIP4_FLAG_REG_HRQST_L2_ALL (0x80|0x40|0x20) #define IPMIP4_CODE_REG_HRPLY_SUCCESS 0 #define IPMIP4_CODE_REG_HRPLY_FAILURE 1 #define IPMIP4_TYPE_REG_REGREVREQ 7 #define IPMIP4_REG_EXT_REGREV_FLAG_INFORM (1 << 0) #define IPMIP4_REG_EXT_REGREV_FLAG_AGENT (1 << 1) #define IPMIP4_REGREVREQ_LENGTH 20 typedef struct IP_PACKED1 Ipmip4_regrevreq { Ip_u8 type; Ip_u8 reserved; Ip_u16 flags; Ip_u32 home_address; Ip_u32 home_domain; Ip_u32 foreign_domain; Ip_u32 identifier; } IP_PACKED2 Ipmip4_regrevreq_t; #define IPMIP4_TYPE_REG_REGREVACK 15 #define IPMIP4_REGREVACK_LENGTH 12 typedef struct IP_PACKED1 Ipmip4_regrevack { Ip_u8 type; Ip_u8 reserved; Ip_u16 flags; Ip_u32 home_address; Ip_u32 identifier; } IP_PACKED2 Ipmip4_regrevack_t; typedef struct IP_PACKED1 Ipmip4_reg_ext_cvse { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 reserved; Ip_u16 length; /* Length of this CVSE */ Ip_u32 vendor_id; /* Vendor data */ Ip_u16 vendor_type; /* Vendor Type */ Ip_u8 vendor_data[2]; } IP_PACKED2 Ipmip4_reg_ext_cvse_t; typedef struct IP_PACKED1 Ipmip4_reg_ext_nvse { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; /* Length of this NVSE */ Ip_u16 reserved; /* Reserved */ Ip_u32 vendor_id; /* Vendor identifier */ Ip_u16 vendor_type; /* Vendor Type */ Ip_u8 vendor_data[2]; } IP_PACKED2 Ipmip4_reg_ext_nvse_t; /**/ #define IPMIP4_REG_EXT_UDP_FLAG_FORCED 0x80 #define IPMIP4_REG_EXT_UDP_FLAG_REGREQ 0x40 typedef struct IP_PACKED1 Ipmip4_reg_ext_udp_tunnel_req { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; Ip_u8 sub_type; /* Sub type */ Ip_u8 __reserved1[1]; Ip_u8 flags; /* Flags */ Ip_u8 encap; /* Encapsulation */ Ip_u8 __reserved2[2]; } IP_PACKED2 Ipmip4_reg_ext_udp_tunnel_req_t; typedef struct IP_PACKED1 Ipmip4_reg_ext_udp_tunnel_rep { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; Ip_u8 sub_type; /* Sub type */ Ip_u8 code; /* Reply code */ Ip_u8 flags; /* Flags */ Ip_u8 __reserved1[1]; /* */ Ip_u16 keep_alive; /* Keep alive */ } IP_PACKED2 Ipmip4_reg_ext_udp_tunnel_rep_t; #define IPMIP4_REG_EXT_REVOCATION_INFORM 0x01 typedef struct IP_PACKED1 Ipmip4_reg_ext_revocation { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; Ip_u16 flags; Ip_u32 timestamp; } IP_PACKED2 Ipmip4_reg_ext_revocation_t; /* *=========================================================================== * Auth extension (sub-type of reg_ext) *=========================================================================== */ #define IPMIP4_EXT_AUTHHDR_LENGTH 6 #define IPMIP4_EXT_AUTH_LENGTH 22 typedef struct IP_PACKED1 Ipmip4_ext_auth { Ip_u8 type; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u8 length; /* 4+16 (spi+authenticator) */ Ip_u8 spi[4]; /* use IP_SET_HTONL IP_GET_NTOHL with this one */ Ip_u8 authenticator[16]; /* MD5 */ /* size sum 22 */ } IP_PACKED2 Ipmip4_ext_auth_t; #define IPMIP4_EXT_GENAUTHHDR_LENGTH 8 #define IPMIP4_EXT_GENAUTH_LENGTH 24 typedef struct IP_PACKED1 Ipmip4_ext_gen_auth { Ip_u8 type; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u8 subtype; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u16 length; /* 4+16 (spi+authenticator) */ Ip_u8 spi[4]; /* use IP_SET_HTONL IP_GET_NTOHL with this one */ Ip_u8 authenticator[16]; /* MD5 */ /* size sum 22 */ } IP_PACKED2 Ipmip4_ext_gen_auth_t; typedef struct IP_PACKED1 Ipmip4_ext_keyreq { Ip_u8 type; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u8 subtype; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u16 length; /* 4+16 (spi+authenticator) */ Ip_u8 spi[4]; /* use IP_SET_HTONL IP_GET_NTOHL with this one */ } IP_PACKED2 Ipmip4_ext_keyreq_t; #define IPMIP4_EXT_KEYREP_HA_LENGTH 20 typedef struct IP_PACKED1 Ipmip4_ext_keyrep_ha { Ip_u8 type; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u8 subtype; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u16 length; /* 4+16 (spi+authenticator) */ Ip_u32 lifetime; Ip_u32 aaa_spi; Ip_u32 spi; Ip_u16 alg_id; Ip_u16 replay; Ip_u8 nonce[4]; } IP_PACKED2 Ipmip4_ext_keyrep_ha_t; #define IPMIP4_EXT_KEYREP_FA_LENGTH 18 typedef struct IP_PACKED1 Ipmip4_ext_keyrep_fa { Ip_u8 type; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u8 subtype; /* 32=mn-ha, 33=mn-fa, 34=fa-ha */ Ip_u16 length; /* 4+16 (spi+authenticator) */ Ip_u32 lifetime; Ip_u32 aaa_spi; Ip_u32 spi; Ip_u16 alg_id; Ip_u8 nonce[2]; } IP_PACKED2 Ipmip4_ext_keyrep_fa_t; /* *=========================================================================== * NEMO extension (sub-type of reg_ext) *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_reg_ext_mobnet_req { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; Ip_u8 sub_type; /* Sub type */ Ip_u8 prefix_len; /* Reply code */ Ip_u32 prefix; /* Prefix */ } IP_PACKED2 Ipmip4_reg_ext_mobnet_req_t; typedef struct IP_PACKED1 Ipmip4_reg_ext_mobnet_rep { Ip_u8 type; /* One of the IPMIP4_EXT_TYPE_xxx constants */ Ip_u8 length; Ip_u8 sub_type; /* Sub type */ Ip_u8 code; /* Sub type */ Ip_u8 prefix_len; /* Reply code */ Ip_u8 reserved; /* Reply code */ Ip_u8 prefix[4]; /* Prefix */ } IP_PACKED2 Ipmip4_reg_ext_mobnet_rep_t; /* *=========================================================================== * Ipmip4_msgext_shdr *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_msgext_shdr { Ip_u8 type; Ip_u8 length; } IP_PACKED2 Ipmip4_msgext_shdr_t; /* *=========================================================================== * Ipmip4_msgext_lhdr *=========================================================================== */ typedef struct IP_PACKED1 Ipmip4_msgext_lhdr { Ip_u8 type; Ip_u8 subtype; Ip_u16 length; } IP_PACKED2 Ipmip4_msgext_lhdr_t; typedef struct IP_PACKED1 Ipmip4_nvse { Ip_u8 __reserved[2]; Ip_u8 vendor_id[4]; /* ID in network byte order */ Ip_u8 vendor_type[2]; /* Type in network byte order */ Ip_u8 vendor_data[4]; /* May be larger, set to this size for align purposes */ } IP_PACKED2 Ipmip4_nvse_t; typedef struct IP_PACKED1 Ipmip4_cvse { Ip_u8 vendor_id[4]; /* ID in network byte order */ Ip_u8 vendor_type[2]; /* Type in network byte order */ Ip_u8 vendor_data[2]; /* May be larger, set to this size for align purposes */ } IP_PACKED2 Ipmip4_cvse_t; typedef struct IP_PACKED1 Ipmip4_pmipv4_per_node_auth_method { Ip_u8 type; Ip_u8 subtype; Ip_u16 length; Ip_u8 method; } IP_PACKED2 Ipmip4_pmipv4_per_node_auth_method_t; typedef struct IP_PACKED1 Ipmip4_pmipv4_access_type { Ip_u8 type; Ip_u8 length; Ip_u8 sub_type; Ip_u8 tech_type; } IP_PACKED2 Ipmip4_pmipv4_access_type_t; typedef struct IP_PACKED1 Ipmip4_pmipv4_interface_id { Ip_u8 type; Ip_u8 length; Ip_u8 sub_type; Ip_u8 identifier[1]; } IP_PACKED2 Ipmip4_pmipv4_interface_id_t; typedef struct IP_PACKED1 Ipmip4_pmipv4_device_id { Ip_u8 type; Ip_u8 length; Ip_u8 sub_type; Ip_u8 id_type; Ip_u8 identifier[4]; /* May be larger, set to this size for align purposes */ } IP_PACKED2 Ipmip4_pmipv4_device_id_t; typedef struct IP_PACKED1 Ipmip4_pmipv4_subscriber_id { Ip_u8 type; Ip_u8 length; Ip_u8 sub_type; Ip_u8 id_type; Ip_u8 identifier[4]; /* May be larger, set to this size for align purposes */ } IP_PACKED2 Ipmip4_pmipv4_subscriber_id_t; #include struct Ipmip4_context; struct Ipmip_proc; struct Ipmip4_pktbuf; typedef union Ipmip4_msgext_uhdr { Ipmip4_msgext_lhdr_t lhdr; Ipmip4_msgext_shdr_t shdr; } Ipmip4_msgext_uhdr_t; typedef struct Ipmip4_msgext_array { int found; Ipmip4_msgext_uhdr_t *ext[IPMIP4_MSGEXT_MAX_EXTENSIONS]; } Ipmip4_msgext_array_t; typedef struct Ipmip4_msgext_mobile { int result; Ipmip4_msgext_uhdr_t *erronous; /* LLAS */ Ipmip4_msgext_array_t lla; /* MOBNET requests */ Ipmip4_msgext_array_t mobnet; /* Authentication Extensions */ Ipmip4_msgext_uhdr_t *mobile_home; Ipmip4_msgext_uhdr_t *mobile_foreign; Ipmip4_msgext_uhdr_t *foreign_foreign; Ipmip4_msgext_uhdr_t *foreign_home; Ipmip4_msgext_uhdr_t *mn_aaa; Ipmip4_msgext_uhdr_t *mn_fa_keyreq; Ipmip4_msgext_uhdr_t *mn_fa_keyrep; Ipmip4_msgext_uhdr_t *mn_ha_keyreq; Ipmip4_msgext_uhdr_t *mn_ha_keyrep; /* Various extensions */ Ipmip4_msgext_uhdr_t *revocation; Ipmip4_msgext_uhdr_t *challenge; Ipmip4_msgext_uhdr_t *nai_agent_ha; Ipmip4_msgext_uhdr_t *nai_agent_aaah; Ipmip4_msgext_uhdr_t *nai_mobile; Ipmip4_msgext_uhdr_t *udp_tunnel_rep; Ipmip4_msgext_uhdr_t *udp_tunnel_req; Ipmip4_msgext_uhdr_t *fa_error; Ipmip4_msgext_uhdr_t *dynamic_ha_request; Ipmip4_msgext_uhdr_t *dynamic_ha_redirect; /* Proxy MIPv4 Extensions */ Ip_u8 pmipv4_extensions; Ipmip4_msgext_uhdr_t *pmipv4_node_auth_method; Ipmip4_msgext_uhdr_t *pmipv4_interface_id; Ipmip4_msgext_uhdr_t *pmipv4_device_id; Ipmip4_msgext_uhdr_t *pmipv4_subscriber_id; Ipmip4_msgext_uhdr_t *pmipv4_access_type; Ipmip4_vendor_ext_msgext_t vendor; } Ipmip4_msgext_mobile_t; typedef int (*Ipmip4_msgext_parse_ext_t) (struct Ipmip4_context *ctx, struct Ipmip_proc *proc, struct Ipmip4_pktbuf *pbuf, Ipmip4_msgext_uhdr_t *uhdr, void *extdata); typedef int (*Ipmip4_msgext_parse_t) (Ipmip4_msgext_mobile_t *mobile, Ipmip4_msgext_uhdr_t *uhdr); typedef int (*Ipmip4_msgext_vendor_callback_t) (Ipmip4_msgext_mobile_t *mobile, void *mdata, int req); typedef struct Ipmip4_msgext_vendor_parse { Ipcom_list next; Ip_u32 vendor_id; Ipmip4_msgext_parse_t parse; Ipmip4_msgext_vendor_callback_t callback; } Ipmip4_msgext_vendor_parse_t; typedef struct Ipmip4_msgext_vendor_parse_ext { Ipcom_list next; Ip_u32 vendor_id; Ipmip_pktbuf_payload_t pktaux; Ipmip4_msgext_parse_ext_t parse; } Ipmip4_msgext_vendor_parse_ext_t; typedef struct Ipmip4_msgext_parse_config { Ipcom_list vendor; } Ipmip4_msgext_parse_config_t; typedef struct Ipmip4_msgext_icmp { /* LLAS */ Ipmip4_msgext_array_t lla; /* Various extensions */ Ipmip4_msgext_uhdr_t *challenge; Ipmip4_msgext_uhdr_t *agent; Ipmip4_msgext_uhdr_t *nai_agent_ha; Ipmip4_msgext_uhdr_t *nai_agent_aaah; } Ipmip4_msgext_icmp_t; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /******************************************************************************* * * ipmip4_msgext_mobile_find - ipmip4_msgext_mobile_find * * Locate an extension in an 'extension buffer'. * * Parameters: * \is * \i extensions * The extension. * \i length * The length of extensions. * \i types * The extension(s) we're looking for * \i type_size * Number of types. * \i hdr * The extension header * \i hdr_size * The size of the extension header * \ie * * RETURNS: The total size of the extension. * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_ssize_t ipmip4_msgext_mobile_find ( Ip_u8 *extensions, Ip_ssize_t length, Ip_u8 *types, Ip_u8 type_size, Ip_u8 **hdr, Ip_u8 *hdr_size ); /******************************************************************************* * * ipmip4_msgext_icmp_find - ipmip4_msgext_icmp_find * * Locate an extension in an 'extension buffer'. * * Parameters: * \is * \i extensions * The extension. * \i length * The length of extensions. * \i types * The extension(s) we're looking for * \i type_size * Number of types. * \i hdr * The extension header * \i hdr_size * The size of the extension header * \ie * * RETURNS: The total size of the extension. * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ip_ssize_t ipmip4_msgext_icmp_find ( Ip_u8 *extensions, Ip_ssize_t length, Ip_u8 *types, Ip_u8 type_size, Ip_u8 **hdr, Ip_u8 *hdr_size ); /******************************************************************************* * * ipmip4_msgext_mobile_parse_ext - ipmip4_msgext_mobile_parse_ext * * Parse a mobile message and extract and do basic verification * on the extensions. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP4. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip4_context_create(). See ipmip4_context.h for * more information regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i pbuf * Packet buffer * \i offset * Offset to start parsing * \ie * * RETURNS: IPMIP4_REG_EXT_SUCCESS on success. * * ERRNO: * * NOMANUAL */ IP_GLOBAL int ipmip4_msgext_mobile_parse_ext ( struct Ipmip4_context *ctx, struct Ipmip_proc *proc, struct Ipmip4_pktbuf *pbuf, Ip_size_t offset ); /******************************************************************************* * * ipmip4_msgext_icmp_parse - ipmip4_msgext_icmp_parse * * Parse an icmp message and extract and do basic verification * on the extensions. * * Parameters: * \is * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i ifname * Name of arriving interface * \i from * The source address. * \i msgext * The icmp msg extension object. * \i ext_ptr * Pointer to the extension block * \i ext_size * Size of the extension block. * \ie * * RETURNS: IPMIP4_REG_EXT_SUCCESS on success. * * ERRNO: * * NOMANUAL */ IP_GLOBAL int ipmip4_msgext_icmp_parse ( struct Ipmip_proc *proc, char *ifname, Ip_u32 from, Ipmip4_msgext_icmp_t *msgext, Ip_u8 *ext_ptr, Ip_ssize_t ext_size ); /******************************************************************************* * * ipmip4_msgext_shdr_equal - ipmip4_msgext_shdr_equal * * Compare two shdrs and see if they're equal. * * Parameters: * \is * \i hdr1 * First header. * \i hdr2 * Second header * \ie * * RETURNS: IP_TRUE if equal, IP_FALSE otherwise. * * ERRNO: * */ IP_GLOBAL Ip_bool ipmip4_msgext_shdr_equal ( Ipmip4_msgext_uhdr_t *hdr1, Ipmip4_msgext_uhdr_t *hdr2 ); /******************************************************************************* * * ipmip4_msgext_lhdr_equal - ipmip4_msgext_lhdr_equal * * Compare two lhdrs and see if they're equal. * * Parameters: * \is * \i hdr1 * First header. * \i hdr2 * Second header * \ie * * RETURNS: IP_TRUE if equal, IP_FALSE otherwise. * * ERRNO: * */ IP_GLOBAL Ip_bool ipmip4_msgext_lhdr_equal ( Ipmip4_msgext_uhdr_t *hdr1, Ipmip4_msgext_uhdr_t *hdr2 ); /******************************************************************************* * * ipmip4_msgext_shdr_dup - ipmip4_msgext_shdr_dup * * Duplicate a shdr * * Parameters: * \is * \i hdr * hdr to duplicate * \ie * * RETURNS: A newly allocated duplicate, or IP_NULL if it fails. * * ERRNO: * */ IP_GLOBAL Ipmip4_msgext_uhdr_t * ipmip4_msgext_shdr_dup ( Ipmip4_msgext_uhdr_t *hdr ); /******************************************************************************* * * ipmip4_msgext_lhdr_dup - ipmip4_msgext_lhdr_dup * * Duplicate a lhdr * * Parameters: * \is * \i hdr * hdr to duplicate * \ie * * RETURNS: A newly allocated duplicate, or IP_NULL if it fails. * * ERRNO: * */ IP_GLOBAL Ipmip4_msgext_uhdr_t * ipmip4_msgext_lhdr_dup ( Ipmip4_msgext_uhdr_t *hdr ); /******************************************************************************* * * ipmip4_msgext_errmsg - ipmip4_msgext_errmsg * * Returns the human readable representation of an error * code. * * Parameters: * \is * \i errcode * The error code * \ie * * RETURNS: A const char array with the appropriate error message text. * * ERRNO: * */ IP_GLOBAL const char * ipmip4_msgext_errmsg ( int errcode ); /******************************************************************************* * * ipmip4_msgext_buffer_append_lhdr - ipmip4_msgext_buffer_append_lhdr * * Append an LHDR to a buffer pointer. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i uhdr * The LHDR * \ie * * RETURNS: The offset to the stored data if successful, -1 otherwise. * * ERRNO: * */ IP_GLOBAL int ipmip4_msgext_buffer_append_lhdr ( Ipmip_buffer_t *buf, Ipmip4_msgext_uhdr_t *uhdr ); /******************************************************************************* * * ipmip4_msgext_buffer_append_shdr - ipmip4_msgext_buffer_append_shdr * * Append an SHDR to a buffer pointer. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i uhdr * The SHDR * \ie * * RETURNS: The offset to the stored data if successful, -1 otherwise. * * ERRNO: * */ IP_GLOBAL int ipmip4_msgext_buffer_append_shdr ( Ipmip_buffer_t *buf, Ipmip4_msgext_uhdr_t *uhdr ); /******************************************************************************* * * ipmip4_msgext_buffer_create_shdr - ipmip4_msgext_buffer_create_shdr * * Create a SHDR * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i type * The SHDR type * \i nelem * Number of elements to concatenate * \i ... * nelem data, size pairs. * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip4_msgext_buffer_create_shdr ( Ipmip_buffer_t *buf, Ip_u32 type, Ip_size_t nelem, ... ); /******************************************************************************* * * ipmip4_msgext_vendor_parse_ext_register - ipmip4_msgext_vendor_parse_ext_register * * Register a vendor extension parse structure * * Parameters: * \is * \i pext * Vendor registration extension * \i nelem * Number of elements to concatenate * \i ... * nelem data, size pairs. * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip4_msgext_vendor_parse_ext_register ( Ipcom_list *vendor_list, struct Ipmip_pktbuf_pktaux *pktaux, Ipmip4_msgext_vendor_parse_ext_t *pext ); /******************************************************************************* * * ipmip4_msgext_mobile_copy - ipmip4_msgext_mobile_copy * * Copy all MSGEXT and buffer information from src to dst. The values * and data in src will be freed once this call has been completed. The * same goes for all values that existed in dst prior to this call. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP4. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip4_context_create(). See ipmip4_context.h for * more information regarding the mobility entity context singleton. * \i pbuf_dst * Destination * \i pbuf_src * Source * \ie * * RETURNS: No return value * * ERRNO: * * NOMANUAL */ IP_GLOBAL void ipmip4_msgext_mobile_copy ( struct Ipmip4_context *ctx, struct Ipmip4_pktbuf *pbuf_dst, struct Ipmip4_pktbuf *pbuf_src ); /******************************************************************************* * * ipmip4_msgext_nai_mn - ipmip4_msgext_nai_mn * * Create a NAI_MN based on the nai that has been provided in this function. * If naibuf is IP_NULL, data will be dynamically allocated to create it, * otherwise it will be assumed that naibuf is large enough to hold the * NAI_MN * * Parameters: * \is * \i naibuf * Buffer to create the NAI in, or IP_NULL if it is to be created dynamically * \i nai * The NAI to use * \i nai_len * The length of the NAI * \ie * * RETURNS: The newly created NAI_MN. * * ERRNO: * */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_nai_mn ( void *naibuf, const char *nai, Ip_size_t nai_len ); /******************************************************************************* * * ipmip4_msgext_nai_mn_dup - ipmip4_msgext_nai_mn_dup * * Duplicate a NAI_MN. The copy is stored in dynamically allocated memory. * * Parameters: * \is * \i nai * The nai to duplicate * \ie * * RETURNS: The newly created NAI_MN. * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_nai_mn_dup ( Ipmip4_msgext_shdr_t *nai ); /******************************************************************************* * * ipmip4_msgext_pmipv4_per_node_auth_method - ipmip4_msgext_pmipv4_per_node_auth_method * * Create a PMIPv4 per node auth mobility extension based on the method provided. * The extension will be created in dynamically allocated memory. * * Parameters: * \is * \i method * The authentication method * \ie * * RETURNS: The newly created extension * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_lhdr_t *ipmip4_msgext_pmipv4_per_node_auth_method ( Ip_u8 method ); /******************************************************************************* * * ipmip4_msgext_pmipv4_access_type - ipmip4_msgext_pmipv4_access_type * * Create a PMIPv4 access type mobility extension based on the access type provided. * The extension will be created in dynamically allocated memory. * * Parameters: * \is * \i access_type * The access type * \ie * * RETURNS: The newly created extension * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_pmipv4_access_type ( Ip_u8 access_type ); /******************************************************************************* * * ipmip4_msgext_pmipv4_device_id - ipmip4_msgext_pmipv4_device_id * * Create a PMIPv4 device id mobility extension based on the access type provided. * The extension will be created in dynamically allocated memory. * * Parameters: * \is * \i device_id * The device identifier * \i device_data * The device identifier data * \i device_data_len * The length of device data * \ie * * RETURNS: The newly created extension * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_pmipv4_device_id ( Ip_u8 device_id, void *device_data, Ip_size_t device_data_len ); /******************************************************************************* * * ipmip4_msgext_pmipv4_interface_id - ipmip4_msgext_pmipv4_interface_id * * Create a PMIPv4 interface id mobility extension based on the access type provided. * The extension will be created in dynamically allocated memory. * * Parameters: * \is * \i if_data * The interface identifier data * \i if_data_len * The length of interface identifier data * \ie * * RETURNS: The newly created extension * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_pmipv4_interface_id ( void *if_data, Ip_size_t if_data_len ); /******************************************************************************* * * ipmip4_msgext_pmipv4_subscriber_id - ipmip4_msgext_pmipv4_subscriber_id * * Create a PMIPv4 subscriber id mobility extension based on the access type provided. * The extension will be created in dynamically allocated memory. * * Parameters: * \is * \i sub_id * The subscriber identifier * \i sub_data * The subscriber identifier data * \i sub_data_len * The length of subscriber data * \ie * * RETURNS: The newly created extension * * ERRNO: * * NOMANUAL */ IP_GLOBAL Ipmip4_msgext_shdr_t *ipmip4_msgext_pmipv4_subscriber_id ( Ip_u8 sub_id, void *sub_data, Ip_size_t sub_data_len ); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */