diff options
author | Patrick McHardy <kaber@trash.net> | 2008-03-25 23:18:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-25 23:18:57 -0400 |
commit | ea45f12a2766dae54e5426a23e8f4bafdbe2782e (patch) | |
tree | eb3096bee1e0053c545424f9cea5d0c91b114fe4 /include | |
parent | ac3677406d4e36e86b1eb5a453997a3b3e0c089a (diff) |
[NETFILTER]: nf_conntrack_sip: parse SIP headers properly
Introduce new function for SIP header parsing that properly deals with
continuation lines and whitespace in headers and use it.
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 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 480b26f40ce4..ccc701422963 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
@@ -5,14 +5,6 @@ | |||
5 | #define SIP_PORT 5060 | 5 | #define SIP_PORT 5060 |
6 | #define SIP_TIMEOUT 3600 | 6 | #define SIP_TIMEOUT 3600 |
7 | 7 | ||
8 | enum sip_header_pos { | ||
9 | POS_FROM, | ||
10 | POS_TO, | ||
11 | POS_VIA, | ||
12 | POS_CONTACT, | ||
13 | POS_CONTENT, | ||
14 | }; | ||
15 | |||
16 | struct sip_header { | 8 | struct sip_header { |
17 | const char *name; | 9 | const char *name; |
18 | const char *cname; | 10 | const char *cname; |
@@ -36,9 +28,20 @@ struct sip_header { | |||
36 | .match_len = (__match), \ | 28 | .match_len = (__match), \ |
37 | } | 29 | } |
38 | 30 | ||
31 | #define SIP_HDR(__name, __cname, __search, __match) \ | ||
32 | __SIP_HDR(__name, __cname, __search, __match) | ||
33 | |||
39 | #define SDP_HDR(__name, __search, __match) \ | 34 | #define SDP_HDR(__name, __search, __match) \ |
40 | __SIP_HDR(__name, NULL, __search, __match) | 35 | __SIP_HDR(__name, NULL, __search, __match) |
41 | 36 | ||
37 | enum sip_header_types { | ||
38 | SIP_HDR_FROM, | ||
39 | SIP_HDR_TO, | ||
40 | SIP_HDR_CONTACT, | ||
41 | SIP_HDR_VIA, | ||
42 | SIP_HDR_CONTENT_LENGTH, | ||
43 | }; | ||
44 | |||
42 | enum sdp_header_types { | 45 | enum sdp_header_types { |
43 | SDP_HDR_UNSPEC, | 46 | SDP_HDR_UNSPEC, |
44 | SDP_HDR_VERSION, | 47 | SDP_HDR_VERSION, |
@@ -60,13 +63,10 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, | |||
60 | extern int ct_sip_parse_request(const struct nf_conn *ct, | 63 | extern int ct_sip_parse_request(const struct nf_conn *ct, |
61 | const char *dptr, unsigned int datalen, | 64 | const char *dptr, unsigned int datalen, |
62 | unsigned int *matchoff, unsigned int *matchlen); | 65 | unsigned int *matchoff, unsigned int *matchlen); |
63 | extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, | 66 | extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, |
64 | size_t dlen, unsigned int *matchoff, | 67 | unsigned int dataoff, unsigned int datalen, |
65 | unsigned int *matchlen, enum sip_header_pos pos); | 68 | enum sip_header_types type, |
66 | extern int ct_sip_lnlen(const char *line, const char *limit); | 69 | unsigned int *matchoff, unsigned int *matchlen); |
67 | extern const char *ct_sip_search(const char *needle, const char *haystack, | ||
68 | size_t needle_len, size_t haystack_len, | ||
69 | int case_sensitive); | ||
70 | 70 | ||
71 | extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, | 71 | extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, |
72 | unsigned int dataoff, unsigned int datalen, | 72 | unsigned int dataoff, unsigned int datalen, |