1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _NF_CONNTRACK_H323_H 3 #define _NF_CONNTRACK_H323_H 4 5 #include <linux/netfilter.h> 6 #include <linux/skbuff.h> 7 #include <linux/types.h> 8 #include <linux/netfilter/nf_conntrack_h323_asn1.h> 9 #include <net/netfilter/nf_conntrack_expect.h> 10 #include <uapi/linux/netfilter/nf_conntrack_tuple_common.h> 11 12 #define RAS_PORT 1719 13 #define Q931_PORT 1720 14 #define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */ 15 16 /* This structure exists only once per master */ 17 struct nf_ct_h323_master { 18 19 /* Original and NATed Q.931 or H.245 signal ports */ 20 __be16 sig_port[IP_CT_DIR_MAX]; 21 22 /* Original and NATed RTP ports */ 23 __be16 rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX]; 24 25 union { 26 /* RAS connection timeout */ 27 u_int32_t timeout; 28 29 /* Next TPKT length (for separate TPKT header and data) */ 30 u_int16_t tpkt_len[IP_CT_DIR_MAX]; 31 }; 32 }; 33 34 int get_h225_addr(struct nf_conn *ct, unsigned char *data, 35 TransportAddress *taddr, union nf_inet_addr *addr, 36 __be16 *port); 37 void nf_conntrack_h245_expect(struct nf_conn *new, 38 struct nf_conntrack_expect *this); 39 void nf_conntrack_q931_expect(struct nf_conn *new, 40 struct nf_conntrack_expect *this); 41 42 struct nfct_h323_nat_hooks { 43 int (*set_h245_addr)(struct sk_buff *skb, unsigned int protoff, 44 unsigned char **data, int dataoff, 45 H245_TransportAddress *taddr, 46 union nf_inet_addr *addr, __be16 port); 47 int (*set_h225_addr)(struct sk_buff *skb, unsigned int protoff, 48 unsigned char **data, int dataoff, 49 TransportAddress *taddr, 50 union nf_inet_addr *addr, __be16 port); 51 int (*set_sig_addr)(struct sk_buff *skb, 52 struct nf_conn *ct, 53 enum ip_conntrack_info ctinfo, 54 unsigned int protoff, unsigned char **data, 55 TransportAddress *taddr, int count); 56 int (*set_ras_addr)(struct sk_buff *skb, 57 struct nf_conn *ct, 58 enum ip_conntrack_info ctinfo, 59 unsigned int protoff, unsigned char **data, 60 TransportAddress *taddr, int count); 61 int (*nat_rtp_rtcp)(struct sk_buff *skb, 62 struct nf_conn *ct, 63 enum ip_conntrack_info ctinfo, 64 unsigned int protoff, 65 unsigned char **data, int dataoff, 66 H245_TransportAddress *taddr, 67 __be16 port, __be16 rtp_port, 68 struct nf_conntrack_expect *rtp_exp, 69 struct nf_conntrack_expect *rtcp_exp); 70 int (*nat_t120)(struct sk_buff *skb, 71 struct nf_conn *ct, 72 enum ip_conntrack_info ctinfo, 73 unsigned int protoff, 74 unsigned char **data, int dataoff, 75 H245_TransportAddress *taddr, __be16 port, 76 struct nf_conntrack_expect *exp); 77 int (*nat_h245)(struct sk_buff *skb, 78 struct nf_conn *ct, 79 enum ip_conntrack_info ctinfo, 80 unsigned int protoff, 81 unsigned char **data, int dataoff, 82 TransportAddress *taddr, __be16 port, 83 struct nf_conntrack_expect *exp); 84 int (*nat_callforwarding)(struct sk_buff *skb, 85 struct nf_conn *ct, 86 enum ip_conntrack_info ctinfo, 87 unsigned int protoff, 88 unsigned char **data, int dataoff, 89 TransportAddress *taddr, __be16 port, 90 struct nf_conntrack_expect *exp); 91 int (*nat_q931)(struct sk_buff *skb, 92 struct nf_conn *ct, 93 enum ip_conntrack_info ctinfo, 94 unsigned int protoff, 95 unsigned char **data, TransportAddress *taddr, int idx, 96 __be16 port, struct nf_conntrack_expect *exp); 97 }; 98 extern const struct nfct_h323_nat_hooks __rcu *nfct_h323_nat_hook; 99 100 #endif 101