Merge tag 'kvm-s390-next-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / include / linux / netfilter / nf_conntrack_h323_asn1.h
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.
5  *
6  * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
7  *
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.
12  *
13  * Features:
14  *
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
19  *    cleanup.
20  * 4. Thread safe.
21  * 5. Support embedded architectures that has no misaligned memory access
22  *    support.
23  *
24  * Limitations:
25  *
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.
32  *
33  ****************************************************************************/
34
35 #ifndef _NF_CONNTRACK_HELPER_H323_ASN1_H_
36 #define _NF_CONNTRACK_HELPER_H323_ASN1_H_
37
38 /*****************************************************************************
39  * H.323 Types
40  ****************************************************************************/
41 #include <linux/netfilter/nf_conntrack_h323_types.h>
42
43 typedef struct {
44         enum {
45                 Q931_NationalEscape = 0x00,
46                 Q931_Alerting = 0x01,
47                 Q931_CallProceeding = 0x02,
48                 Q931_Connect = 0x07,
49                 Q931_ConnectAck = 0x0F,
50                 Q931_Progress = 0x03,
51                 Q931_Setup = 0x05,
52                 Q931_SetupAck = 0x0D,
53                 Q931_Resume = 0x26,
54                 Q931_ResumeAck = 0x2E,
55                 Q931_ResumeReject = 0x22,
56                 Q931_Suspend = 0x25,
57                 Q931_SuspendAck = 0x2D,
58                 Q931_SuspendReject = 0x21,
59                 Q931_UserInformation = 0x20,
60                 Q931_Disconnect = 0x45,
61                 Q931_Release = 0x4D,
62                 Q931_ReleaseComplete = 0x5A,
63                 Q931_Restart = 0x46,
64                 Q931_RestartAck = 0x4E,
65                 Q931_Segment = 0x60,
66                 Q931_CongestionCtrl = 0x79,
67                 Q931_Information = 0x7B,
68                 Q931_Notify = 0x6E,
69                 Q931_Status = 0x7D,
70                 Q931_StatusEnquiry = 0x75,
71                 Q931_Facility = 0x62
72         } MessageType;
73         H323_UserInformation UUIE;
74 } Q931;
75
76 /*****************************************************************************
77  * Decode Functions Return Codes
78  ****************************************************************************/
79
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
84
85
86 /*****************************************************************************
87  * Decode Functions
88  ****************************************************************************/
89
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 *
94                                          mscm);
95
96 #endif