1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
4 * conntrack/NAT module.
6 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
8 * This library is based on H.225 version 4, H.235 version 2 and H.245
9 * version 7. It is extremely optimized to decode only the absolutely
10 * necessary objects in a signal for Linux kernel NAT module use, so don't
11 * expect it to be a full ASN.1 library.
15 * 1. Small. The total size of code plus data is less than 20 KB (IA32).
16 * 2. Fast. Decoding Netmeeting's Setup signal 1 million times on a PIII 866
17 * takes only 3.9 seconds.
18 * 3. No memory allocation. It uses a static object. No need to initialize or
21 * 5. Support embedded architectures that has no misaligned memory access
26 * 1. At most 30 faststart entries. Actually this is limited by ethernet's MTU.
27 * If a Setup signal contains more than 30 faststart, the packet size will
28 * very likely exceed the MTU size, then the TPKT will be fragmented. I
29 * don't know how to handle this in a Netfilter module. Anybody can help?
30 * Although I think 30 is enough for most of the cases.
31 * 2. IPv4 addresses only.
33 ****************************************************************************/
35 #ifndef _NF_CONNTRACK_HELPER_H323_ASN1_H_
36 #define _NF_CONNTRACK_HELPER_H323_ASN1_H_
38 /*****************************************************************************
40 ****************************************************************************/
41 #include <linux/netfilter/nf_conntrack_h323_types.h>
45 Q931_NationalEscape = 0x00,
47 Q931_CallProceeding = 0x02,
49 Q931_ConnectAck = 0x0F,
54 Q931_ResumeAck = 0x2E,
55 Q931_ResumeReject = 0x22,
57 Q931_SuspendAck = 0x2D,
58 Q931_SuspendReject = 0x21,
59 Q931_UserInformation = 0x20,
60 Q931_Disconnect = 0x45,
62 Q931_ReleaseComplete = 0x5A,
64 Q931_RestartAck = 0x4E,
66 Q931_CongestionCtrl = 0x79,
67 Q931_Information = 0x7B,
70 Q931_StatusEnquiry = 0x75,
73 H323_UserInformation UUIE;
76 /*****************************************************************************
77 * Decode Functions Return Codes
78 ****************************************************************************/
80 #define H323_ERROR_NONE 0 /* Decoded successfully */
81 #define H323_ERROR_STOP 1 /* Decoding stopped, not really an error */
82 #define H323_ERROR_BOUND -1
83 #define H323_ERROR_RANGE -2
86 /*****************************************************************************
88 ****************************************************************************/
90 int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage * ras);
91 int DecodeQ931(unsigned char *buf, size_t sz, Q931 * q931);
92 int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
93 MultimediaSystemControlMessage *