summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-07-28 14:17:42 +0200
committerPatrick McHardy <kaber@trash.net>2009-07-28 14:17:42 +0200
commit11c5f88f81cb628988ddad405c5295fa237b3311 (patch)
tree70771dbc0149fa3f59d2d24e1b1379b3fadf1500 /src/payload.c
parenteaefa819182d968ba6f4958fc8d909165feee0b6 (diff)
payload: add DCCP packet type definitions
# nft describe dccp type payload expression, datatype dccp_pkttype (DCCP packet type) (basetype integer), 4 bits pre-defined symbolic constants: request 0x0 response 0x1 data 0x2 ack 0x3 dataack 0x4 closereq 0x5 close 0x6 reset 0x7 sync 0x8 syncack 0x9 Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/payload.c b/src/payload.c
index f41d4c17..944fed1b 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -691,6 +691,33 @@ const struct payload_desc payload_tcp = {
* DCCP
*/
+static const struct symbol_table dccp_pkttype_tbl = {
+ .symbols = {
+ SYMBOL("request", DCCP_PKT_REQUEST),
+ SYMBOL("response", DCCP_PKT_RESPONSE),
+ SYMBOL("data", DCCP_PKT_DATA),
+ SYMBOL("ack", DCCP_PKT_ACK),
+ SYMBOL("dataack", DCCP_PKT_DATAACK),
+ SYMBOL("closereq", DCCP_PKT_CLOSEREQ),
+ SYMBOL("close", DCCP_PKT_CLOSE),
+ SYMBOL("reset", DCCP_PKT_RESET),
+ SYMBOL("sync", DCCP_PKT_SYNC),
+ SYMBOL("syncack", DCCP_PKT_SYNCACK),
+ SYMBOL_LIST_END
+ },
+};
+
+static const struct datatype dccp_pkttype_type = {
+ .type = TYPE_DCCP_PKTTYPE,
+ .name = "dccp_pkttype",
+ .desc = "DCCP packet type",
+ .byteorder = BYTEORDER_INVALID,
+ .size = 4,
+ .basetype = &integer_type,
+ .sym_tbl = &dccp_pkttype_tbl,
+};
+
+
#define DCCPHDR_FIELD(__name, __member) \
HDR_FIELD(__name, struct dccp_hdr, __member)
@@ -700,6 +727,7 @@ const struct payload_desc payload_dccp = {
.templates = {
[DCCPHDR_SPORT] = INET_SERVICE("sport", struct dccp_hdr, dccph_sport),
[DCCPHDR_DPORT] = INET_SERVICE("dport", struct dccp_hdr, dccph_dport),
+ [DCCPHDR_TYPE] = HDR_BITFIELD("type", &dccp_pkttype_type, 67, 4),
},
};
@@ -925,6 +953,7 @@ static void __init payload_init(void)
{
datatype_register(&icmp_type_type);
datatype_register(&tcp_flag_type);
+ datatype_register(&dccp_pkttype_type);
datatype_register(&arpop_type);
datatype_register(&ethertype_type);
}