📄 packet-802_16.h
字号:
/**************************************************************************************
* *Copyright (c) 2006 Regents of the University of Chang Gung *
* *All rights reserved. * * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * 1. Redistributions of source code must retain the above copyright * * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * 3. All advertising materials mentioning features or use of this software * * must display the following acknowledgement: * * This product includes software developed by the Computer Systems * * Engineering Group at Lawrence Berkeley Laboratory. * * 4. Neither the name of the University nor of the Laboratory may be used * * to endorse or promote products derived from this software without * * specific prior written permission. * *5. If you have any problem about these codes, * please mail to antibanish@gmail.com or b9229008@stmail.cgu.edu.tw *
**************************************************************************************/#ifndef ns_packet_80216_h#define ns_packet_80216_h#include "packet.h"#include "mac-802_16.h"typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; void *VALUE; }TLV_BASIC_V;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[1]; }TLV_BASIC_1;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[2]; }TLV_BASIC_2;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[3]; }TLV_BASIC_3;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[4]; }TLV_BASIC_4;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[5]; }TLV_BASIC_5;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[6]; }TLV_BASIC_6;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[8]; }TLV_BASIC_8;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[9]; }TLV_BASIC_9;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[13]; }TLV_BASIC_13;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[16]; }TLV_BASIC_16;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[20]; }TLV_BASIC_20;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[21]; }TLV_BASIC_21;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[128]; }TLV_BASIC_128;/* 11.13.19.3.4.3 Protocol */#define Protocol_Numbers 3typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[Protocol_Numbers]; }TLV_BASIC_Protocol_N;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[3*Protocol_Numbers]; }TLV_BASIC_Protocol_3N;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[4*Protocol_Numbers]; }TLV_BASIC_Protocol_4N;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[8*Protocol_Numbers]; }TLV_BASIC_Protocol_8N;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[12*Protocol_Numbers]; }TLV_BASIC_Protocol_12N;typedef struct{ u_int16_t FLAG; u_int8_t TYPE; u_int8_t LENGTH; u_int8_t VALUE[32*Protocol_Numbers]; }TLV_BASIC_Protocol_32N;//test /******************************************************************************* TLV Data Base - Common Encoding (11.1 Common encodings)********************************************************************************//* 11.13.19.3.3 Classifier error parameter set pp.708*/typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_2 TYPE_1_Errored_parameter; // Notice 11.13.19.3.3.1 Errored parameter TLV_BASIC_1 TYPE_2_Error_code; TLV_BASIC_V TYPE_3_Error_message;}TLV_SPEC_CST_SUB_2;/* Using IPv4 or IPv6 address */typedef struct{ TLV_BASIC_Protocol_8N IPv4; TLV_BASIC_Protocol_32N IPv6;}TLV_SPEC_CST_SUB_3_IP;/* 11.13.19.3.4 Packet classification rule pp.709*/typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_1 TYPE_1_Classifier_rule_priority; TLV_BASIC_3 TYPE_2_IP_Type_of_DSCP_range_and_mask; TLV_BASIC_Protocol_N TYPE_3_Protocol; TLV_SPEC_CST_SUB_3_IP TYPE_4_IP_masked_source_address; TLV_SPEC_CST_SUB_3_IP TYPE_5_IP_destination_address; TLV_BASIC_Protocol_4N TYPE_6_Protocol_source_port_range; TLV_BASIC_Protocol_4N TYPE_7_Protocol_destination_port_range; TLV_BASIC_Protocol_12N TYPE_8_IEEE_802_3_Ethernet_destination_MAC_address; TLV_BASIC_Protocol_12N TYPE_9_IEEE_802_3_Ethernet_source_MAC_address; TLV_BASIC_3 TYPE_10_Ethertype_IEEE_802_2_SAP; TLV_BASIC_2 TYPE_11_IEEE_802_1D_User_Priority; TLV_BASIC_2 TYPE_12_IEEE_802_1Q_VLAN_ID; TLV_BASIC_1 TYPE_13_Associated_PHSI; TLV_BASIC_2 TYPE_14_Packet_Classifier_Rule_Index; TLV_BASIC_Protocol_3N TYPE_15_IPv6_Flow_label; // USE in CST = 101 / 105 / 107 TLV_BASIC_V *TYPE_143_Vendor_specific_classifier_parameters; // TLVDB_COMMON_ENCODING -> TYPE_143_Vendor_specific_information }TLV_SPEC_CST_SUB_3;/* 11.13.19.3.6 PHS error parameter set pp.714*/typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_1 TYPE_1_Errored_parameter; TLV_BASIC_1 TYPE_2_Error_code; TLV_BASIC_V TYPE_3_Error_message; }TLV_SPEC_CST_SUB_5;/* 11.13.19.3.7 PHS Rule pp.715*/typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_1 TYPE_1_PHSI; TLV_BASIC_V TYPE_2_PHSF;// preparing TYPE_3_PHSM; TLV_BASIC_1 TYPE_4_PHSS; TLV_BASIC_1 TYPE_5_PHSV; TLV_BASIC_V *TYPE_143_Vendor_specific_PHS_parameters;// TLVDB_COMMON_ENCODING -> TYPE_143_Vendor_specific_information }TLV_SPEC_CST_SUB_6;/* 11.13.19.4.2 ATM Classifier TLV pp.718*/typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_2 TYPE_1_VPI_classifier; TLV_BASIC_2 TYPE_2_VCI_classification; TLV_BASIC_16 TYPE_3_ATM_Classifier_ID;}TLV_SPEC_CST_ATM_SUB_2;/* 11.13.19.4 ATM CS Encodings for Configuration and MAC Messaging pp.718*/typedef struct{ TLV_BASIC_1 TYPE_1_ATM_switching_encoding; TLV_SPEC_CST_ATM_SUB_2 TYPE_2_ATM_Classifier_TLV; TLV_BASIC_1 TYPE_3_ATM_Classifier_DSC_Action; //pp.719 TLV_SPEC_CST_SUB_2 TYPE_4_ATM_Classifier_Error_Parameter_Set; //pp.720}TLV_SPEC_CST_ATM;/* 11.13.19.3 Packet CS encodings for configuration and MAC messaging pp.707*/typedef struct{ TLV_BASIC_1 TYPE_1_Classifier_DSC_action; //pp.707 TLV_SPEC_CST_SUB_2 TYPE_2_Classifier_error_parameter_set; //pp.708 TLV_SPEC_CST_SUB_3 TYPE_3_Packet_classification_rule; //pp.709 TLV_BASIC_1 TYPE_4_PHS_DSC_action; //pp.714 TLV_SPEC_CST_SUB_5 TYPE_5_PHS_error_parameter_set; //pp.714 TLV_SPEC_CST_SUB_6 TYPE_6_PHS_Rule; //pp.715 }TLV_SPEC_CST_ENCODING;/* 11.13 Service Flow management encodings */typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_4 TYPE_1_Service_Flow_Identifier; TLV_BASIC_2 TYPE_2_CID; TLV_BASIC_128 TYPE_3_Service_Class_Name;// preparing TYPE_4_reserved; TLV_BASIC_1 TYPE_5_QoS_Parameter_Set_Type; TLV_BASIC_1 TYPE_6_Traffic_Priority; TLV_BASIC_4 TYPE_7_Maximum_Sustained_Traffic_Rate; TLV_BASIC_4 TYPE_8_Maximum_Traffic_Burst; TLV_BASIC_4 TYPE_9_Minimum_Reserved_Traffic_Rate; TLV_BASIC_4 TYPE_10_Minimum_Tolerable_Traffic_Rate; TLV_BASIC_1 TYPE_11_Service_Flow_Scheduling_Type; TLV_BASIC_4 TYPE_12_Request_Transmission_Policy; TLV_BASIC_4 TYPE_13_Tolerated_Jitter; TLV_BASIC_4 TYPE_14_Maximum_Latency; TLV_BASIC_1 TYPE_15_Fixed_length_versus_Variable_length_SDU_Indicator; TLV_BASIC_1 TYPE_16_SDU_Size; TLV_BASIC_2 TYPE_17_Target_SAID; TLV_BASIC_1 TYPE_18_ARQ_Enable; TLV_BASIC_2 TYPE_19_ARQ_WINDOW_SIZE; TLV_BASIC_2 TYPE_20_ARQ_RETRY_TIMEOUT_Transmitter_Delay; TLV_BASIC_2 TYPE_21_ARQ_RETRY_TIMEOUT_Receiver_Delay; TLV_BASIC_2 TYPE_22_ARQ_BLOCK_LIFETIME; TLV_BASIC_2 TYPE_23_ARQ_SYNC_LOSS; TLV_BASIC_1 TYPE_24_ARQ_DELIVER_IN_ORDER; TLV_BASIC_2 TYPE_25_ARQ_PURGE_TIMEOUT; TLV_BASIC_2 TYPE_26_ARQ_BLOCK_SIZE;// preparing TYPE_27_reserved; TLV_BASIC_1 TYPE_28_CS_Specification; TLV_BASIC_V *TYPE_143_Vendor_specific_QoS_Parameter; // TLVDB_COMMON_ENCODING -> TYPE_143_Vendor_specific_information/* 11.13.19.2 CS parameter encoding rules */ TLV_SPEC_CST_ATM TYPE_99_CS_ATM; TLV_SPEC_CST_ENCODING TYPE_100_CS_Packet_IPv4; TLV_SPEC_CST_ENCODING TYPE_101_CS_Packet_IPv6; TLV_SPEC_CST_ENCODING TYPE_102_CS_Packet_802_3_Ethernet; TLV_SPEC_CST_ENCODING TYPE_103_CS_Packet_802_1Q_VLAN; TLV_SPEC_CST_ENCODING TYPE_104_CS_Packet_IPV4_over_802_3_Ethernet; TLV_SPEC_CST_ENCODING TYPE_105_CS_Packet_IPV6_over_802_3_Ethernet; TLV_SPEC_CST_ENCODING TYPE_106_CS_Packet_IPV4_over_802_1Q_VLAN; TLV_SPEC_CST_ENCODING TYPE_107_CS_Packet_IPV6_over_802_1Q_VLAN;}TLV_SPEC_SERVICE_FLOW;/* 11.1 Common encodings */struct TLVDB_COMMON_ENCODING{ TLV_BASIC_V TYPE_143_Vendor_specific_information; TLV_BASIC_3 TYPE_144_Vendor_ID_encoding; TLV_SPEC_SERVICE_FLOW *TYPE_145_Uplink_service_flow; // use the same variable with TYPE_146 TLV_SPEC_SERVICE_FLOW *TYPE_146_Downlink_service_flow; // use the same variable with TYPE_145 TLV_BASIC_1 TYPE_147_Current_transmit_power; TLV_BASIC_1 TYPE_148_MAC_version_encoding; TLV_BASIC_21 TYPE_149_HMAC_tuple; };/******************************************************************************* TLV Data Base - Configuration File (11.2 Configuration file encodings)********************************************************************************/typedef struct{ TLV_BASIC_4 IPv4; TLV_BASIC_16 IPv6; }TLV_SPEC_IP_VERSION;/* 11.2.2 Software upgrade descriptors */typedef struct{// u_int16_t FLAG; u_int8_t LENGTH; TLV_BASIC_V TYPE_1_Hardware_ID; TLV_BASIC_V TYPE_2_Software_version; TLV_BASIC_V TYPE_3_Upgrade_filename; TLV_BASIC_3 *TYPE_144_Vendor_ID; // TLVDB_COMMON_ENCODING -> TYPE_144_Vendor_ID_encoding}TLV_SPEC_UPGRADE;/* 11.2 Configuration file encodings */struct TLVDB_CONFIGURATION_FILE{ TLV_BASIC_20 TYPE_1_SS_MIC_configuration_setting; TLV_SPEC_UPGRADE TYPE_2_Software_upgrade_descriptors; TLV_SPEC_IP_VERSION TYPE_3_Software_upgrade_TFTP_server; TLV_BASIC_4 TYPE_4_TFTP_Server_Timestamp; TLV_SPEC_IP_VERSION TYPE_5_Authorization_Node; TLV_SPEC_IP_VERSION TYPE_6_Registration_Node; TLV_SPEC_IP_VERSION TYPE_7_Provisioning_Node; };/******************************************************************************* TLV Data Base - Management Message********************************************************************************//* Table 350
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -