Commit | Line | Data |
---|---|---|
f361c4dc | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
5e35941d | 2 | /**************************************************************************** |
05ba4c89 | 3 | * BER and PER decoding library for H.323 conntrack/NAT module. |
5e35941d | 4 | * |
7582e9d1 | 5 | * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net> |
5e35941d | 6 | * |
5e35941d JMZ |
7 | * This library is based on H.225 version 4, H.235 version 2 and H.245 |
8 | * version 7. It is extremely optimized to decode only the absolutely | |
9 | * necessary objects in a signal for Linux kernel NAT module use, so don't | |
10 | * expect it to be a full ASN.1 library. | |
11 | * | |
12 | * Features: | |
13 | * | |
14 | * 1. Small. The total size of code plus data is less than 20 KB (IA32). | |
15 | * 2. Fast. Decoding Netmeeting's Setup signal 1 million times on a PIII 866 | |
16 | * takes only 3.9 seconds. | |
17 | * 3. No memory allocation. It uses a static object. No need to initialize or | |
18 | * cleanup. | |
19 | * 4. Thread safe. | |
20 | * 5. Support embedded architectures that has no misaligned memory access | |
21 | * support. | |
22 | * | |
23 | * Limitations: | |
24 | * | |
25 | * 1. At most 30 faststart entries. Actually this is limited by ethernet's MTU. | |
26 | * If a Setup signal contains more than 30 faststart, the packet size will | |
27 | * very likely exceed the MTU size, then the TPKT will be fragmented. I | |
28 | * don't know how to handle this in a Netfilter module. Anybody can help? | |
29 | * Although I think 30 is enough for most of the cases. | |
30 | * 2. IPv4 addresses only. | |
31 | * | |
32 | ****************************************************************************/ | |
33 | ||
f587de0e PM |
34 | #ifndef _NF_CONNTRACK_HELPER_H323_ASN1_H_ |
35 | #define _NF_CONNTRACK_HELPER_H323_ASN1_H_ | |
5e35941d JMZ |
36 | |
37 | /***************************************************************************** | |
38 | * H.323 Types | |
39 | ****************************************************************************/ | |
a1ce3928 | 40 | #include <linux/netfilter/nf_conntrack_h323_types.h> |
5e35941d JMZ |
41 | |
42 | typedef struct { | |
43 | enum { | |
44 | Q931_NationalEscape = 0x00, | |
45 | Q931_Alerting = 0x01, | |
46 | Q931_CallProceeding = 0x02, | |
47 | Q931_Connect = 0x07, | |
48 | Q931_ConnectAck = 0x0F, | |
49 | Q931_Progress = 0x03, | |
50 | Q931_Setup = 0x05, | |
51 | Q931_SetupAck = 0x0D, | |
52 | Q931_Resume = 0x26, | |
53 | Q931_ResumeAck = 0x2E, | |
54 | Q931_ResumeReject = 0x22, | |
55 | Q931_Suspend = 0x25, | |
56 | Q931_SuspendAck = 0x2D, | |
57 | Q931_SuspendReject = 0x21, | |
58 | Q931_UserInformation = 0x20, | |
59 | Q931_Disconnect = 0x45, | |
60 | Q931_Release = 0x4D, | |
61 | Q931_ReleaseComplete = 0x5A, | |
62 | Q931_Restart = 0x46, | |
63 | Q931_RestartAck = 0x4E, | |
64 | Q931_Segment = 0x60, | |
65 | Q931_CongestionCtrl = 0x79, | |
66 | Q931_Information = 0x7B, | |
67 | Q931_Notify = 0x6E, | |
68 | Q931_Status = 0x7D, | |
69 | Q931_StatusEnquiry = 0x75, | |
70 | Q931_Facility = 0x62 | |
71 | } MessageType; | |
72 | H323_UserInformation UUIE; | |
73 | } Q931; | |
74 | ||
75 | /***************************************************************************** | |
76 | * Decode Functions Return Codes | |
77 | ****************************************************************************/ | |
78 | ||
79 | #define H323_ERROR_NONE 0 /* Decoded successfully */ | |
80 | #define H323_ERROR_STOP 1 /* Decoding stopped, not really an error */ | |
81 | #define H323_ERROR_BOUND -1 | |
82 | #define H323_ERROR_RANGE -2 | |
83 | ||
84 | ||
85 | /***************************************************************************** | |
86 | * Decode Functions | |
87 | ****************************************************************************/ | |
88 | ||
89 | int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage * ras); | |
90 | int DecodeQ931(unsigned char *buf, size_t sz, Q931 * q931); | |
91 | int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz, | |
92 | MultimediaSystemControlMessage * | |
93 | mscm); | |
94 | ||
95 | #endif |