Kannel: Open Source WAP and SMS gateway  svn-r5335
smasi_pdu.h
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2018 Kannel Group
5  * Copyright (c) 1998-2001 WapIT Ltd.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Kannel Group (http://www.kannel.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Kannel" and "Kannel Group" must not be used to
28  * endorse or promote products derived from this software without
29  * prior written permission. For written permission, please
30  * contact org@kannel.org.
31  *
32  * 5. Products derived from this software may not be called "Kannel",
33  * nor may "Kannel" appear in their name, without prior written
34  * permission of the Kannel Group.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Kannel Group. For more information on
51  * the Kannel Group, please see <http://www.kannel.org/>.
52  *
53  * Portions of this software are based upon software originally written at
54  * WapIT Ltd., Helsinki, Finland for the Kannel project.
55  */
56 
57 /*
58  * smasi_pdu.h - declarations for SMASI PDUs
59  *
60  * Stipe Tolj <stolj@wapme.de>
61  */
62 
63 
64 #ifndef SMASI_PDU_H
65 #define SMASI_PDU_H
66 
67 #include "gwlib/gwlib.h"
68 
69 /*
70  * Any PDUs that are below this ID will be packed with a
71  * prefixed hyphen.
72  */
73 #define SMASI_HYPHEN_ID 0x00000010
74 
75 enum {
76  #define NONTERMINATED(name)
77  #define COMATERMINATED(name)
78  #define PDU(name, id, fields) name = id,
79  #include "smasi_pdu.def"
80  SMASI_PDU_DUMMY_TYPE
81 };
82 
83 typedef struct SMASI_PDU SMASI_PDU;
84 struct SMASI_PDU {
85  unsigned long type;
86  const char *type_name;
87  unsigned int needs_hyphen;
88  union {
89  #define NONTERMINATED(name) Octstr *name;
90  #define COMATERMINATED(name) Octstr *name;
91  #define PDU(name, id, fields) struct name { fields } name;
92  #include "smasi_pdu.def"
93  } u;
94 };
95 
96 
97 /******************************************************************************
98 * Numering Plan Indicator and Type of Number codes from
99 * GSM 03.40 Version 5.3.0 Section 9.1.2.5.
100 * http://www.etsi.org/
101 */
102 #define GSM_ADDR_TON_UNKNOWN 0x00000000
103 #define GSM_ADDR_TON_INTERNATIONAL 0x00000001
104 #define GSM_ADDR_TON_NATIONAL 0x00000002
105 #define GSM_ADDR_TON_NETWORKSPECIFIC 0x00000003
106 #define GSM_ADDR_TON_SUBSCRIBER 0x00000004
107 #define GSM_ADDR_TON_ALPHANUMERIC 0x00000005 /* GSM TS 03.38 */
108 #define GSM_ADDR_TON_ABBREVIATED 0x00000006
109 #define GSM_ADDR_TON_EXTENSION 0x00000007 /* Reserved */
110 
111 #define GSM_ADDR_NPI_UNKNOWN 0x00000000
112 #define GSM_ADDR_NPI_E164 0x00000001
113 #define GSM_ADDR_NPI_X121 0x00000003
114 #define GSM_ADDR_NPI_TELEX 0x00000004
115 #define GSM_ADDR_NPI_NATIONAL 0x00000008
116 #define GSM_ADDR_NPI_PRIVATE 0x00000009
117 #define GSM_ADDR_NPI_ERMES 0x0000000A /* ETSI DE/PS 3 01-3 */
118 #define GSM_ADDR_NPI_EXTENSION 0x0000000F /* Reserved */
119 
120 /******************************************************************************
121  * esm_class parameters
122  */
123 #define ESM_CLASS_DEFAULT_SMSC_MODE 0x00000000
124 #define ESM_CLASS_DATAGRAM_MODE 0x00000001
125 #define ESM_CLASS_FORWARD_MODE 0x00000002
126 #define ESM_CLASS_STORE_AND_FORWARD_MODE 0x00000003
127 #define ESM_CLASS_DELIVERY_ACK 0x00000008
128 #define ESM_CLASS_USER_ACK 0x00000010
129 #define ESM_CLASS_UDH_INDICATOR 0x00000040
130 #define ESM_CLASS_RPI 0x00000080
131 #define ESM_CLASS_UDH_AND_RPI 0x000000C0
132 
133 
134 SMASI_PDU *smasi_pdu_create(unsigned long type);
135 void smasi_pdu_destroy(SMASI_PDU *pdu);
136 int smasi_pdu_is_valid(SMASI_PDU *pdu); /* XXX */
138 SMASI_PDU *smasi_pdu_unpack(Octstr *data_without_len);
139 void smasi_pdu_dump(SMASI_PDU *pdu);
140 
142 
143 
144 #endif
unsigned int needs_hyphen
Definition: smasi_pdu.h:87
const char * type_name
Definition: smasi_pdu.h:86
Octstr * smasi_pdu_pack(SMASI_PDU *pdu)
Definition: smasi_pdu.c:178
SMASI_PDU * smasi_pdu_create(unsigned long type)
Definition: smasi_pdu.c:132
void smasi_pdu_destroy(SMASI_PDU *pdu)
Definition: smasi_pdu.c:160
unsigned long type
Definition: smasi_pdu.h:85
int type
Definition: smsc_cimd2.c:215
SMASI_PDU * smasi_pdu_unpack(Octstr *data_without_len)
Definition: smasi_pdu.c:223
union SMASI_PDU::@12 u
Octstr * smasi_pdu_read(Connection *conn)
Definition: smasi_pdu.c:299
int smasi_pdu_is_valid(SMASI_PDU *pdu)
Definition: octstr.c:118
void smasi_pdu_dump(SMASI_PDU *pdu)
Definition: smasi_pdu.c:280
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.