diff options
| author | Jing Min Zhao <zhaojingmin@users.sourceforge.net> | 2006-04-06 17:13:42 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2006-04-10 01:25:35 -0400 |
| commit | 48bfee5fad0e46f4f18d46285efceba39e897482 (patch) | |
| tree | f527020c7163d519fdc6fd6d38f9473b6ce739bf /include/linux | |
| parent | 32292a7ff1d9306841a8da6ea286847b1070cc6a (diff) | |
[NETFILTER]: H.323 helper: move some function prototypes to ip_conntrack_h323.h
Move prototypes of NAT callbacks to ip_conntrack_h323.h. Because the
use of typedefs as arguments, some header files need to be moved as
well.
Signed-off-by: Jing Min Zhao <zhaojingmin@users.sourceforge.net>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
3 files changed, 1088 insertions, 0 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h index 0987cea538..eace86bd2a 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
| 5 | 5 | ||
| 6 | #include <linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h> | ||
| 7 | |||
| 6 | #define RAS_PORT 1719 | 8 | #define RAS_PORT 1719 |
| 7 | #define Q931_PORT 1720 | 9 | #define Q931_PORT 1720 |
| 8 | #define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */ | 10 | #define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */ |
| @@ -25,6 +27,56 @@ struct ip_ct_h323_master { | |||
| 25 | }; | 27 | }; |
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 30 | struct ip_conntrack_expect; | ||
| 31 | |||
| 32 | extern int get_h225_addr(unsigned char *data, TransportAddress * addr, | ||
| 33 | u_int32_t * ip, u_int16_t * port); | ||
| 34 | extern void ip_conntrack_h245_expect(struct ip_conntrack *new, | ||
| 35 | struct ip_conntrack_expect *this); | ||
| 36 | extern void ip_conntrack_q931_expect(struct ip_conntrack *new, | ||
| 37 | struct ip_conntrack_expect *this); | ||
| 38 | extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, | ||
| 39 | unsigned char **data, int dataoff, | ||
| 40 | H245_TransportAddress * addr, | ||
| 41 | u_int32_t ip, u_int16_t port); | ||
| 42 | extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, | ||
| 43 | unsigned char **data, int dataoff, | ||
| 44 | TransportAddress * addr, | ||
| 45 | u_int32_t ip, u_int16_t port); | ||
| 46 | extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, | ||
| 47 | struct ip_conntrack * ct, | ||
| 48 | enum ip_conntrack_info ctinfo, | ||
| 49 | unsigned char **data, | ||
| 50 | TransportAddress * addr, int count); | ||
| 51 | extern int (*set_ras_addr_hook) (struct sk_buff ** pskb, | ||
| 52 | struct ip_conntrack * ct, | ||
| 53 | enum ip_conntrack_info ctinfo, | ||
| 54 | unsigned char **data, | ||
| 55 | TransportAddress * addr, int count); | ||
| 56 | extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb, | ||
| 57 | struct ip_conntrack * ct, | ||
| 58 | enum ip_conntrack_info ctinfo, | ||
| 59 | unsigned char **data, int dataoff, | ||
| 60 | H245_TransportAddress * addr, | ||
| 61 | u_int16_t port, u_int16_t rtp_port, | ||
| 62 | struct ip_conntrack_expect * rtp_exp, | ||
| 63 | struct ip_conntrack_expect * rtcp_exp); | ||
| 64 | extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
| 65 | enum ip_conntrack_info ctinfo, | ||
| 66 | unsigned char **data, int dataoff, | ||
| 67 | H245_TransportAddress * addr, u_int16_t port, | ||
| 68 | struct ip_conntrack_expect * exp); | ||
| 69 | extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
| 70 | enum ip_conntrack_info ctinfo, | ||
| 71 | unsigned char **data, int dataoff, | ||
| 72 | TransportAddress * addr, u_int16_t port, | ||
| 73 | struct ip_conntrack_expect * exp); | ||
| 74 | extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
| 75 | enum ip_conntrack_info ctinfo, | ||
| 76 | unsigned char **data, TransportAddress * addr, | ||
| 77 | int idx, u_int16_t port, | ||
| 78 | struct ip_conntrack_expect * exp); | ||
| 79 | |||
| 28 | #endif | 80 | #endif |
| 29 | 81 | ||
| 30 | #endif | 82 | #endif |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h new file mode 100644 index 0000000000..0bd828081c --- /dev/null +++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /**************************************************************************** | ||
| 2 | * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323 | ||
| 3 | * conntrack/NAT module. | ||
| 4 | * | ||
| 5 | * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@hotmail.com> | ||
| 6 | * | ||
| 7 | * This source code is licensed under General Public License version 2. | ||
| 8 | * | ||
| 9 | * | ||
| 10 | * This library is based on H.225 version 4, H.235 version 2 and H.245 | ||
| 11 | * version 7. It is extremely optimized to decode only the absolutely | ||
| 12 | * necessary objects in a signal for Linux kernel NAT module use, so don't | ||
| 13 | * expect it to be a full ASN.1 library. | ||
| 14 | * | ||
| 15 | * Features: | ||
| 16 | * | ||
| 17 | * 1. Small. The total size of code plus data is less than 20 KB (IA32). | ||
| 18 | * 2. Fast. Decoding Netmeeting's Setup signal 1 million times on a PIII 866 | ||
| 19 | * takes only 3.9 seconds. | ||
| 20 | * 3. No memory allocation. It uses a static object. No need to initialize or | ||
| 21 | * cleanup. | ||
| 22 | * 4. Thread safe. | ||
| 23 | * 5. Support embedded architectures that has no misaligned memory access | ||
| 24 | * support. | ||
| 25 | * | ||
| 26 | * Limitations: | ||
| 27 | * | ||
| 28 | * 1. At most 30 faststart entries. Actually this is limited by ethernet's MTU. | ||
| 29 | * If a Setup signal contains more than 30 faststart, the packet size will | ||
| 30 | * very likely exceed the MTU size, then the TPKT will be fragmented. I | ||
| 31 | * don't know how to handle this in a Netfilter module. Anybody can help? | ||
| 32 | * Although I think 30 is enough for most of the cases. | ||
| 33 | * 2. IPv4 addresses only. | ||
| 34 | * | ||
| 35 | ****************************************************************************/ | ||
| 36 | |||
| 37 | #ifndef _IP_CONNTRACK_HELPER_H323_ASN1_H_ | ||
| 38 | #define _IP_CONNTRACK_HELPER_H323_ASN1_H_ | ||
| 39 | |||
| 40 | /***************************************************************************** | ||
| 41 | * H.323 Types | ||
| 42 | ****************************************************************************/ | ||
| 43 | #include "ip_conntrack_helper_h323_types.h" | ||
| 44 | |||
| 45 | typedef struct { | ||
| 46 | enum { | ||
| 47 | Q931_NationalEscape = 0x00, | ||
| 48 | Q931_Alerting = 0x01, | ||
| 49 | Q931_CallProceeding = 0x02, | ||
| 50 | Q931_Connect = 0x07, | ||
| 51 | Q931_ConnectAck = 0x0F, | ||
| 52 | Q931_Progress = 0x03, | ||
| 53 | Q931_Setup = 0x05, | ||
| 54 | Q931_SetupAck = 0x0D, | ||
| 55 | Q931_Resume = 0x26, | ||
| 56 | Q931_ResumeAck = 0x2E, | ||
| 57 | Q931_ResumeReject = 0x22, | ||
| 58 | Q931_Suspend = 0x25, | ||
| 59 | Q931_SuspendAck = 0x2D, | ||
| 60 | Q931_SuspendReject = 0x21, | ||
| 61 | Q931_UserInformation = 0x20, | ||
| 62 | Q931_Disconnect = 0x45, | ||
| 63 | Q931_Release = 0x4D, | ||
| 64 | Q931_ReleaseComplete = 0x5A, | ||
| 65 | Q931_Restart = 0x46, | ||
| 66 | Q931_RestartAck = 0x4E, | ||
| 67 | Q931_Segment = 0x60, | ||
| 68 | Q931_CongestionCtrl = 0x79, | ||
| 69 | Q931_Information = 0x7B, | ||
| 70 | Q931_Notify = 0x6E, | ||
| 71 | Q931_Status = 0x7D, | ||
| 72 | Q931_StatusEnquiry = 0x75, | ||
| 73 | Q931_Facility = 0x62 | ||
| 74 | } MessageType; | ||
| 75 | H323_UserInformation UUIE; | ||
| 76 | } Q931; | ||
| 77 | |||
| 78 | /***************************************************************************** | ||
| 79 | * Decode Functions Return Codes | ||
| 80 | ****************************************************************************/ | ||
| 81 | |||
| 82 | #define H323_ERROR_NONE 0 /* Decoded successfully */ | ||
| 83 | #define H323_ERROR_STOP 1 /* Decoding stopped, not really an error */ | ||
| 84 | #define H323_ERROR_BOUND -1 | ||
| 85 | #define H323_ERROR_RANGE -2 | ||
| 86 | |||
| 87 | |||
| 88 | /***************************************************************************** | ||
| 89 | * Decode Functions | ||
| 90 | ****************************************************************************/ | ||
| 91 | |||
| 92 | int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage * ras); | ||
| 93 | int DecodeQ931(unsigned char *buf, size_t sz, Q931 * q931); | ||
| 94 | int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz, | ||
| 95 | MultimediaSystemControlMessage * | ||
| 96 | mscm); | ||
| 97 | |||
| 98 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h new file mode 100644 index 0000000000..cc98f7aa5a --- /dev/null +++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h | |||
| @@ -0,0 +1,938 @@ | |||
| 1 | /* Generated by Jing Min Zhao's ASN.1 parser, Mar 15 2006 | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net> | ||
| 4 | * | ||
| 5 | * This source code is licensed under General Public License version 2. | ||
| 6 | */ | ||
| 7 | |||
| 8 | typedef struct TransportAddress_ipAddress { /* SEQUENCE */ | ||
| 9 | int options; /* No use */ | ||
| 10 | unsigned ip; | ||
| 11 | } TransportAddress_ipAddress; | ||
| 12 | |||
| 1 | |||
