1 /****************************************************************************
2 * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323
3 * conntrack/NAT module.
5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
7 * This source code is licensed under General Public License version 2.
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.
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
23 * 5. Support embedded architectures that has no misaligned memory access
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.
35 ****************************************************************************/
37 #ifndef _IP_CONNTRACK_HELPER_H323_ASN1_H_
38 #define _IP_CONNTRACK_HELPER_H323_ASN1_H_
40 /*****************************************************************************
42 ****************************************************************************/
43 #include "ip_conntrack_helper_h323_types.h"
47 Q931_NationalEscape
= 0x00,
49 Q931_CallProceeding
= 0x02,
51 Q931_ConnectAck
= 0x0F,
56 Q931_ResumeAck
= 0x2E,
57 Q931_ResumeReject
= 0x22,
59 Q931_SuspendAck
= 0x2D,
60 Q931_SuspendReject
= 0x21,
61 Q931_UserInformation
= 0x20,
62 Q931_Disconnect
= 0x45,
64 Q931_ReleaseComplete
= 0x5A,
66 Q931_RestartAck
= 0x4E,
68 Q931_CongestionCtrl
= 0x79,
69 Q931_Information
= 0x7B,
72 Q931_StatusEnquiry
= 0x75,
75 H323_UserInformation UUIE
;
78 /*****************************************************************************
79 * Decode Functions Return Codes
80 ****************************************************************************/
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
88 /*****************************************************************************
90 ****************************************************************************/
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
*