diff options
author | khemendra kumar <khemendra.kumar13@gmail.com> | 2017-12-08 18:06:52 +0530 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-09 13:24:39 +0000 |
commit | 34719e37bf820e8398ca9159725f7f4c42764aeb (patch) | |
tree | 0103490ec7c18b6c1a46ef59fcca0722e7061764 /src/vnet/dhcp/dhcp6_packet.h | |
parent | 87a137c77b53753710a0706a35bee5574c0a9c1a (diff) |
VPP-249 Coding standards cleanup - vnet/vnet/dhcp
Change-Id: I45a166b5780675d2bc6fe90595f413725704eaa8
Signed-off-by: khemendra kumar <khemendra.kumar13@gmail.com>
Diffstat (limited to 'src/vnet/dhcp/dhcp6_packet.h')
-rw-r--r-- | src/vnet/dhcp/dhcp6_packet.h | 173 |
1 files changed, 102 insertions, 71 deletions
diff --git a/src/vnet/dhcp/dhcp6_packet.h b/src/vnet/dhcp/dhcp6_packet.h index 24a18144b16..97a89385836 100644 --- a/src/vnet/dhcp/dhcp6_packet.h +++ b/src/vnet/dhcp/dhcp6_packet.h @@ -31,83 +31,90 @@ /* * DHCPv6 message types */ -typedef enum dhcpv6_msg_type_{ - DHCPV6_MSG_SOLICIT = 1, - DHCPV6_MSG_ADVERTISE = 2, - DHCPV6_MSG_REQUEST = 3, - DHCPV6_MSG_CONFIRM = 4, - DHCPV6_MSG_RENEW = 5, - DHCPV6_MSG_REBIND = 6, - DHCPV6_MSG_REPLY = 7, - DHCPV6_MSG_RELEASE = 8, - DHCPV6_MSG_DECLINE = 9, - DHCPV6_MSG_RECONFIGURE = 10, - DHCPV6_MSG_INFORMATION_REQUEST = 11, - DHCPV6_MSG_RELAY_FORW = 12, - DHCPV6_MSG_RELAY_REPL = 13, +typedef enum dhcpv6_msg_type_ +{ + DHCPV6_MSG_SOLICIT = 1, + DHCPV6_MSG_ADVERTISE = 2, + DHCPV6_MSG_REQUEST = 3, + DHCPV6_MSG_CONFIRM = 4, + DHCPV6_MSG_RENEW = 5, + DHCPV6_MSG_REBIND = 6, + DHCPV6_MSG_REPLY = 7, + DHCPV6_MSG_RELEASE = 8, + DHCPV6_MSG_DECLINE = 9, + DHCPV6_MSG_RECONFIGURE = 10, + DHCPV6_MSG_INFORMATION_REQUEST = 11, + DHCPV6_MSG_RELAY_FORW = 12, + DHCPV6_MSG_RELAY_REPL = 13, } dhcpv6_msg_type_t; /* * DHCPv6 options types */ -enum { - DHCPV6_OPTION_CLIENTID = 1, - DHCPV6_OPTION_SERVERID = 2, - DHCPV6_OPTION_IA_NA = 3, - DHCPV6_OPTION_IA_TA = 4, - DHCPV6_OPTION_IAADDR = 5, - DHCPV6_OPTION_ORO = 6, - DHCPV6_OPTION_PREFERENCE = 7, - DHCPV6_OPTION_ELAPSED_TIME = 8, - DHCPV6_OPTION_RELAY_MSG = 9, - DHCPV6_OPTION_AUTH = 11, - DHCPV6_OPTION_UNICAST = 12, - DHCPV6_OPTION_STATUS_CODE = 13, - DHCPV6_OPTION_RAPID_COMMIT = 14, - DHCPV6_OPTION_USER_CLASS = 15, - DHCPV6_OPTION_VENDOR_CLASS = 16, - DHCPV6_OPTION_VENDOR_OPTS = 17, - DHCPV6_OPTION_INTERFACE_ID = 18, // relay agent fills this - DHCPV6_OPTION_RECONF_MSG = 19, - DHCPV6_OPTION_RECONF_ACCEPT = 20, - DHCPV6_OPTION_REMOTEID = 37, // relay agent fills this - DHCPV6_OPTION_VSS = 68, // relay agent fills this - DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS = 79, - DHCPV6_OPTION_MAX +enum +{ + DHCPV6_OPTION_CLIENTID = 1, + DHCPV6_OPTION_SERVERID = 2, + DHCPV6_OPTION_IA_NA = 3, + DHCPV6_OPTION_IA_TA = 4, + DHCPV6_OPTION_IAADDR = 5, + DHCPV6_OPTION_ORO = 6, + DHCPV6_OPTION_PREFERENCE = 7, + DHCPV6_OPTION_ELAPSED_TIME = 8, + DHCPV6_OPTION_RELAY_MSG = 9, + DHCPV6_OPTION_AUTH = 11, + DHCPV6_OPTION_UNICAST = 12, + DHCPV6_OPTION_STATUS_CODE = 13, + DHCPV6_OPTION_RAPID_COMMIT = 14, + DHCPV6_OPTION_USER_CLASS = 15, + DHCPV6_OPTION_VENDOR_CLASS = 16, + DHCPV6_OPTION_VENDOR_OPTS = 17, + DHCPV6_OPTION_INTERFACE_ID = 18, // relay agent fills this + DHCPV6_OPTION_RECONF_MSG = 19, + DHCPV6_OPTION_RECONF_ACCEPT = 20, + DHCPV6_OPTION_REMOTEID = 37, // relay agent fills this + DHCPV6_OPTION_VSS = 68, // relay agent fills this + DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS = 79, + DHCPV6_OPTION_MAX }; /* * DHCPv6 status codes */ -enum { - DHCPV6_STATUS_SUCCESS = 0, - DHCPV6_STATUS_UNSPEC_FAIL = 1, - DHCPV6_STATUS_NOADDRS_AVAIL = 2, - DHCPV6_STATUS_NO_BINDING = 3, - DHCPV6_STATUS_NOT_ONLINK = 4, - DHCPV6_STATUS_USE_MULTICAST = 5, +enum +{ + DHCPV6_STATUS_SUCCESS = 0, + DHCPV6_STATUS_UNSPEC_FAIL = 1, + DHCPV6_STATUS_NOADDRS_AVAIL = 2, + DHCPV6_STATUS_NO_BINDING = 3, + DHCPV6_STATUS_NOT_ONLINK = 4, + DHCPV6_STATUS_USE_MULTICAST = 5, }; /* * DHCPv6 DUID types */ -enum { - DHCPV6_DUID_LLT = 1, /* DUID Based on Link-layer Address Plus Time */ - DHCPV6_DUID_EN = 2, /* DUID Based on Enterprise Number */ - DHCPV6_DUID_LL = 3, /* DUID Based on Link-layer Address */ +enum +{ + DHCPV6_DUID_LLT = 1, /* DUID Based on Link-layer Address Plus Time */ + DHCPV6_DUID_EN = 2, /* DUID Based on Enterprise Number */ + DHCPV6_DUID_LL = 3, /* DUID Based on Link-layer Address */ }; //Structure for DHCPv6 payload from client -typedef struct dhcpv6_hdr_ { - union { - u8 msg_type; //DHCP msg type - u32 xid; // transaction id - }u; - u8 data[0]; +typedef struct dhcpv6_hdr_ +{ + union + { + u8 msg_type; //DHCP msg type + u32 xid; // transaction id + } u; + u8 data[0]; } dhcpv6_header_t; +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct dhcpv6_relay_ctx_ { dhcpv6_header_t *pkt; u32 pkt_len; @@ -118,8 +125,10 @@ typedef CLIB_PACKED (struct dhcpv6_relay_ctx_ { char ctx_name[32+1]; u8 dhcp_msg_type; }) dhcpv6_relay_ctx_t; +/* *INDENT-ON* */ //Structure for DHCPv6 RELAY-FORWARD and DHCPv6 RELAY-REPLY pkts +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct dhcpv6_relay_hdr_ { u8 msg_type; u8 hop_count; @@ -127,58 +136,80 @@ typedef CLIB_PACKED (struct dhcpv6_relay_hdr_ { ip6_address_t peer_addr; u8 data[0]; }) dhcpv6_relay_hdr_t; +/* *INDENT-ON* */ -typedef enum dhcp_stats_action_type_ { - DHCP_STATS_ACTION_FORWARDED=1, - DHCP_STATS_ACTION_RECEIVED, - DHCP_STATS_ACTION_DROPPED +typedef enum dhcp_stats_action_type_ +{ + DHCP_STATS_ACTION_FORWARDED = 1, + DHCP_STATS_ACTION_RECEIVED, + DHCP_STATS_ACTION_DROPPED } dhcp_stats_action_type_t; //Generic counters for a packet -typedef struct dhcp_stats_counters_ { - u64 rx_pkts; //counter for received pkts - u64 tx_pkts; //counter for forwarded pkts - u64 drops; //counter for dropped pkts +typedef struct dhcp_stats_counters_ +{ + u64 rx_pkts; //counter for received pkts + u64 tx_pkts; //counter for forwarded pkts + u64 drops; //counter for dropped pkts } dhcp_stats_counters_t; -typedef enum dhcpv6_stats_drop_reason_ { - DHCPV6_RELAY_PKT_DROP_RELAYDISABLE = 1, - DHCPV6_RELAY_PKT_DROP_MAX_HOPS, - DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL, - DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF, - DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT, - DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL, - DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT, +typedef enum dhcpv6_stats_drop_reason_ +{ + DHCPV6_RELAY_PKT_DROP_RELAYDISABLE = 1, + DHCPV6_RELAY_PKT_DROP_MAX_HOPS, + DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL, + DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF, + DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT, + DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL, + DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT, } dhcpv6_stats_drop_reason_t; +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { u16 option; u16 length; u8 data[0]; }) dhcpv6_option_t; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { dhcpv6_option_t opt; u32 int_idx; }) dhcpv6_int_id_t; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { dhcpv6_option_t opt; u8 vss_type; u8 data[0]; }) dhcpv6_vss_t; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { dhcpv6_option_t opt; u32 ent_num; u32 rmt_id; }) dhcpv6_rmt_id_t; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { dhcpv6_option_t opt; u16 link_type; u8 data[6]; // data[0]:data[5]: MAC address }) dhcpv6_client_mac_t; +/* *INDENT-ON* */ #endif /* included_vnet_dhcp6_packet_h */ + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ |