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 extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
42 				  unsigned char **data, int dataoff,
43 				  H245_TransportAddress *taddr,
44 				  union nf_inet_addr *addr,
45 				  __be16 port);
46 extern int (*set_h225_addr_hook) (struct sk_buff *skb, unsigned int protoff,
47 				  unsigned char **data, int dataoff,
48 				  TransportAddress *taddr,
49 				  union nf_inet_addr *addr,
50 				  __be16 port);
51 extern int (*set_sig_addr_hook) (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 extern int (*set_ras_addr_hook) (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 extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
62 				 struct nf_conn *ct,
63 				 enum ip_conntrack_info ctinfo,
64 				 unsigned int protoff, unsigned char **data,
65 				 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 extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
71 			     enum ip_conntrack_info ctinfo,
72 			     unsigned int protoff,
73 			     unsigned char **data, int dataoff,
74 			     H245_TransportAddress *taddr, __be16 port,
75 			     struct nf_conntrack_expect *exp);
76 extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct,
77 			     enum ip_conntrack_info ctinfo,
78 			     unsigned int protoff,
79 			     unsigned char **data, int dataoff,
80 			     TransportAddress *taddr, __be16 port,
81 			     struct nf_conntrack_expect *exp);
82 extern int (*nat_callforwarding_hook) (struct sk_buff *skb,
83 				       struct nf_conn *ct,
84 				       enum ip_conntrack_info ctinfo,
85 				       unsigned int protoff,
86 				       unsigned char **data, int dataoff,
87 				       TransportAddress *taddr,
88 				       __be16 port,
89 				       struct nf_conntrack_expect *exp);
90 extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct,
91 			     enum ip_conntrack_info ctinfo,
92 			     unsigned int protoff,
93 			     unsigned char **data, TransportAddress *taddr,
94 			     int idx, __be16 port,
95 			     struct nf_conntrack_expect *exp);
96 
97 #endif
98