diff options
author | Patrick McHardy <kaber@trash.net> | 2008-03-25 23:17:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-25 23:17:55 -0400 |
commit | 3e9b4600b4e71beaa9d943251bfe9c25f6a97b8c (patch) | |
tree | cb04b3e40f545d104207784982fb55485f231da5 /include | |
parent | 779382eb324ad0c39f8c4d10a47a813b490ab82c (diff) |
[NETFILTER]: nf_conntrack_sip: add seperate SDP header parsing function
SDP and SIP headers are quite different, SIP can have continuation lines,
leading and trailing whitespace after the colon and is mostly case-insensitive
while SDP headers always begin on a new line and are followed by an equal
sign and the value, without any whitespace.
Introduce new SDP header parsing function and convert all users that used
the SIP header parsing function. This will allow to properly deal with the
special SIP cases in the SIP header parsing function later.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter/nf_conntrack_sip.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index b94de3d60303..9131cbc9b9de 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
@@ -13,12 +13,42 @@ enum sip_header_pos { | |||
13 | POS_VIA, | 13 | POS_VIA, |
14 | POS_CONTACT, | 14 | POS_CONTACT, |
15 | POS_CONTENT, | 15 | POS_CONTENT, |
16 | POS_MEDIA, | 16 | }; |
17 | POS_OWNER_IP4, | 17 | |
18 | POS_CONNECTION_IP4, | 18 | struct sip_header { |
19 | POS_OWNER_IP6, | 19 | const char *name; |
20 | POS_CONNECTION_IP6, | 20 | const char *cname; |
21 | POS_SDP_HEADER, | 21 | const char *search; |
22 | unsigned int len; | ||
23 | unsigned int clen; | ||
24 | unsigned int slen; | ||
25 | int (*match_len)(const struct nf_conn *ct, | ||
26 | const char *dptr, const char *limit, | ||
27 | int *shift); | ||
28 | }; | ||
29 | |||
30 | #define __SIP_HDR(__name, __cname, __search, __match) \ | ||
31 | { \ | ||
32 | .name = (__name), \ | ||
33 | .len = sizeof(__name) - 1, \ | ||
34 | .cname = (__cname), \ | ||
35 | .clen = (__cname) ? sizeof(__cname) - 1 : 0, \ | ||
36 | .search = (__search), \ | ||
37 | .slen = (__search) ? sizeof(__search) - 1 : 0, \ | ||
38 | .match_len = (__match), \ | ||
39 | } | ||
40 | |||
41 | #define SDP_HDR(__name, __search, __match) \ | ||
42 | __SIP_HDR(__name, NULL, __search, __match) | ||
43 | |||
44 | enum sdp_header_types { | ||
45 | SDP_HDR_UNSPEC, | ||
46 | SDP_HDR_VERSION, | ||
47 | SDP_HDR_OWNER_IP4, | ||
48 | SDP_HDR_CONNECTION_IP4, | ||
49 | SDP_HDR_OWNER_IP6, | ||
50 | SDP_HDR_CONNECTION_IP6, | ||
51 | SDP_HDR_MEDIA, | ||
22 | }; | 52 | }; |
23 | 53 | ||
24 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, | 54 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, |
@@ -36,5 +66,12 @@ extern int ct_sip_lnlen(const char *line, const char *limit); | |||
36 | extern const char *ct_sip_search(const char *needle, const char *haystack, | 66 | extern const char *ct_sip_search(const char *needle, const char *haystack, |
37 | size_t needle_len, size_t haystack_len, | 67 | size_t needle_len, size_t haystack_len, |
38 | int case_sensitive); | 68 | int case_sensitive); |
69 | |||
70 | extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, | ||
71 | unsigned int dataoff, unsigned int datalen, | ||
72 | enum sdp_header_types type, | ||
73 | enum sdp_header_types term, | ||
74 | unsigned int *matchoff, unsigned int *matchlen); | ||
75 | |||
39 | #endif /* __KERNEL__ */ | 76 | #endif /* __KERNEL__ */ |
40 | #endif /* __NF_CONNTRACK_SIP_H__ */ | 77 | #endif /* __NF_CONNTRACK_SIP_H__ */ |