Kannel: Open Source WAP and SMS gateway  svn-r5335
wtp.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  * wtp.h - WTP implementation general header, common things for the iniator
59  * and the responder.
60  */
61 
62 #ifndef WTP_H
63 #define WTP_H
64 
65 #include <errno.h>
66 #include <sys/types.h>
67 #include <netinet/in.h>
68 #include <stdlib.h>
69 
70 #include "gwlib/gwlib.h"
71 #include "wap_addr.h"
72 #include "wap_events.h"
73 
74 /*
75  * Use this structure for storing segments to be reassembled
76  */
77 typedef struct WTPSegment WTPSegment;
78 
79 /*
80  * For removing the magic
81  */
82 enum {
86 };
87 
88 /*
89  * For now, timers are defined. They will depend on bearer information fetched
90  * from address (or from a header field of the protocol speaking with the
91  * bearerbox). For suggested timers, see WTP, Appendix A.
92  */
93 enum {
101 };
102 
103 /*
104  * Maximum values for counters (for retransmissions and acknowledgement waiting
105  * periods)
106  */
107 enum {
108  AEC_MAX = 6,
110 };
111 
112 /*
113  * Types of acknowledgement PDU (normal acknowledgement or tid verification)
114  */
115 enum {
118 };
119 
120 /*
121  * Who is aborting (WTP or WTP user)
122  */
123 enum {
124  PROVIDER = 0x00,
125  USER = 0x01
126 };
127 
128 /*
129  * WTP abort types (i.e., provider abort codes defined by WAP)
130  */
131 enum {
132  UNKNOWN = 0x00,
133  PROTOERR = 0x01,
134  INVALIDTID = 0x02,
140  NORESPONSE = 0x08,
143 };
144 
145 /*
146  * Transaction classes
147  */
148 enum {
152 };
153 
154 /*
155  * Types of acknowledgement
156  */
157 enum {
160 };
161 
162 /*
163  * Who is indicating, wtp initiator or responder.
164  */
165 enum {
168 };
169 
170 enum {
172  TPI_INFO = 1,
174  TPI_PSN = 3,
177 };
178 
179 /*
180  * Responder set first tid, initiator not. So all tids send by initiator are
181  * greater than 2**15.
182  */
183 #define INITIATOR_TID_LIMIT (1 << 15)
184 
185 /*
186  * Transaction is identified by the address four-tuple and tid.
187  */
190  long tid;
191  long mid;
192 };
193 
195 
196 /*
197  * Handles possible concatenated messages. Returns a list of wap events,
198  * consisting of these events.
199  */
201 
202 /*
203  * Responder set the first bit of the tid field. If we get a packet from the
204  * responder, we are the initiator.
205  *
206  * Returns 1 for responder, 0 for iniator and -1 for error.
207  */
209 
210 #endif
List * wtp_unpack_wdp_datagram(WAPEvent *datagram)
Definition: wtp.c:98
Definition: wtp.h:125
Definition: wtp.h:171
long tid
Definition: wtp.h:190
Definition: wtp.h:174
Definition: wtp.h:109
struct WTPSegment WTPSegment
Definition: wtp.h:77
WAPAddrTuple * tuple
Definition: wtp.h:189
int wtp_event_is_for_responder(WAPEvent *event)
Definition: wtp.c:156
long mid
Definition: wtp.h:191
Definition: wtp.h:124
Definition: wtp.h:172
Definition: wtp.h:132
Definition: list.c:102
Definition: wtp.h:133
Definition: wtp.h:108
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.