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 38 struct nfct_h323_nat_hooks { 39 int (*set_h245_addr)(struct sk_buff *skb, unsigned int protoff, 40 unsigned char **data, int dataoff, 41 H245_TransportAddress *taddr, 42 union nf_inet_addr *addr, __be16 port); 43 int (*set_h225_addr)(struct sk_buff *skb, unsigned int protoff, 44 unsigned char **data, int dataoff, 45 TransportAddress *taddr, 46 union nf_inet_addr *addr, __be16 port); 47 int (*set_sig_addr)(struct sk_buff *skb, 48 struct nf_conn *ct, 49 enum ip_conntrack_info ctinfo, 50 unsigned int protoff, unsigned char **data, 51 TransportAddress *taddr, int count); 52 int (*set_ras_addr)(struct sk_buff *skb, 53 struct nf_conn *ct, 54 enum ip_conntrack_info ctinfo, 55 unsigned int protoff, unsigned char **data, 56 TransportAddress *taddr, int count); 57 int (*nat_rtp_rtcp)(struct sk_buff *skb, 58 struct nf_conn *ct, 59 enum ip_conntrack_info ctinfo, 60 unsigned int protoff, 61 unsigned char **data, int dataoff, 62 H245_TransportAddress *taddr, 63 __be16 port, __be16 rtp_port, 64 struct nf_conntrack_expect *rtp_exp, 65 struct nf_conntrack_expect *rtcp_exp); 66 int (*nat_t120)(struct sk_buff *skb, 67 struct nf_conn *ct, 68 enum ip_conntrack_info ctinfo, 69 unsigned int protoff, 70 unsigned char **data, int dataoff, 71 H245_TransportAddress *taddr, __be16 port, 72 struct nf_conntrack_expect *exp); 73 int (*nat_h245)(struct sk_buff *skb, 74 struct nf_conn *ct, 75 enum ip_conntrack_info ctinfo, 76 unsigned int protoff, 77 unsigned char **data, int dataoff, 78 TransportAddress *taddr, __be16 port, 79 struct nf_conntrack_expect *exp); 80 int (*nat_callforwarding)(struct sk_buff *skb, 81 struct nf_conn *ct, 82 enum ip_conntrack_info ctinfo, 83 unsigned int protoff, 84 unsigned char **data, int dataoff, 85 TransportAddress *taddr, __be16 port, 86 struct nf_conntrack_expect *exp); 87 int (*nat_q931)(struct sk_buff *skb, 88 struct nf_conn *ct, 89 enum ip_conntrack_info ctinfo, 90 unsigned int protoff, 91 unsigned char **data, TransportAddress *taddr, int idx, 92 __be16 port, struct nf_conntrack_expect *exp); 93 }; 94 extern const struct nfct_h323_nat_hooks __rcu *nfct_h323_nat_hook; 95 96 #endif 97