Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wtp.h

Go to the documentation of this file.
00001 /* ==================================================================== 
00002  * The Kannel Software License, Version 1.0 
00003  * 
00004  * Copyright (c) 2001-2008 Kannel Group  
00005  * Copyright (c) 1998-2001 WapIT Ltd.   
00006  * All rights reserved. 
00007  * 
00008  * Redistribution and use in source and binary forms, with or without 
00009  * modification, are permitted provided that the following conditions 
00010  * are met: 
00011  * 
00012  * 1. Redistributions of source code must retain the above copyright 
00013  *    notice, this list of conditions and the following disclaimer. 
00014  * 
00015  * 2. Redistributions in binary form must reproduce the above copyright 
00016  *    notice, this list of conditions and the following disclaimer in 
00017  *    the documentation and/or other materials provided with the 
00018  *    distribution. 
00019  * 
00020  * 3. The end-user documentation included with the redistribution, 
00021  *    if any, must include the following acknowledgment: 
00022  *       "This product includes software developed by the 
00023  *        Kannel Group (http://www.kannel.org/)." 
00024  *    Alternately, this acknowledgment may appear in the software itself, 
00025  *    if and wherever such third-party acknowledgments normally appear. 
00026  * 
00027  * 4. The names "Kannel" and "Kannel Group" must not be used to 
00028  *    endorse or promote products derived from this software without 
00029  *    prior written permission. For written permission, please  
00030  *    contact org@kannel.org. 
00031  * 
00032  * 5. Products derived from this software may not be called "Kannel", 
00033  *    nor may "Kannel" appear in their name, without prior written 
00034  *    permission of the Kannel Group. 
00035  * 
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00039  * DISCLAIMED.  IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS 
00040  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,  
00041  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  
00042  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR  
00043  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
00044  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE  
00045  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,  
00046  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00047  * ==================================================================== 
00048  * 
00049  * This software consists of voluntary contributions made by many 
00050  * individuals on behalf of the Kannel Group.  For more information on  
00051  * the Kannel Group, please see <http://www.kannel.org/>. 
00052  * 
00053  * Portions of this software are based upon software originally written at  
00054  * WapIT Ltd., Helsinki, Finland for the Kannel project.  
00055  */ 
00056 
00057 /*
00058  * wtp.h - WTP implementation general header, common things for the iniator 
00059  * and the responder.
00060  */
00061 
00062 #ifndef WTP_H
00063 #define WTP_H
00064 
00065 #include <errno.h>
00066 #include <sys/types.h>
00067 #include <netinet/in.h>
00068 #include <stdlib.h>
00069 
00070 #include "gwlib/gwlib.h"
00071 #include "wap_addr.h"
00072 #include "wap_events.h"
00073 
00074 /* 
00075  * Use this structure for storing segments to be reassembled
00076  */
00077 typedef struct WTPSegment WTPSegment;
00078 
00079 /*
00080  * For removing the magic
00081  */
00082 enum {
00083     NUMBER_OF_ABORT_TYPES = 2,
00084     NUMBER_OF_ABORT_REASONS  = 10,
00085     NUMBER_OF_TRANSACTION_CLASSES = 3
00086 };
00087 
00088 /*
00089  * For now, timers are defined. They will depend on bearer information fetched
00090  * from address (or from a header field of the protocol speaking with the
00091  * bearerbox). For suggested timers, see WTP, Appendix A.
00092  */
00093 enum {
00094     L_A_WITH_USER_ACK = 4,
00095     L_R_WITH_USER_ACK = 7,
00096     S_R_WITHOUT_USER_ACK = 3,
00097     S_R_WITH_USER_ACK = 4,
00098     G_R_WITHOUT_USER_ACK = 3,
00099     G_R_WITH_USER_ACK = 3,
00100     W_WITH_USER_ACK = 30
00101 };
00102 
00103 /*
00104  * Maximum values for counters (for retransmissions and acknowledgement waiting
00105  * periods)
00106  */
00107 enum {
00108     AEC_MAX = 6,
00109     MAX_RCR = 8
00110 };
00111 
00112 /*
00113  * Types of acknowledgement PDU (normal acknowledgement or tid verification)
00114  */
00115 enum {
00116     ACKNOWLEDGEMENT = 0,
00117     TID_VERIFICATION = 1
00118 };
00119 
00120 /*
00121  * Who is aborting (WTP or WTP user)
00122  */
00123 enum {
00124     PROVIDER = 0x00,
00125     USER = 0x01
00126 };
00127 
00128 /*
00129  * WTP abort types (i.e., provider abort codes defined by WAP)
00130  */
00131 enum {
00132     UNKNOWN = 0x00,
00133     PROTOERR = 0x01,
00134     INVALIDTID = 0x02,
00135     NOTIMPLEMENTEDCL2 = 0x03,
00136     NOTIMPLEMENTEDSAR = 0x04,
00137     NOTIMPLEMENTEDUACK = 0x05,
00138     WTPVERSIONZERO = 0x06,
00139     CAPTEMPEXCEEDED = 0x07,
00140     NORESPONSE = 0x08,
00141     MESSAGETOOLARGE = 0x09,
00142     NOTIMPLEMENTEDESAR = 0x0A
00143 };    
00144 
00145 /*
00146  * Transaction classes
00147  */
00148 enum {
00149     TRANSACTION_CLASS_0 = 0,
00150     TRANSACTION_CLASS_1 = 1,
00151     TRANSACTION_CLASS_2 = 2
00152 };
00153 
00154 /*
00155  * Types of acknowledgement
00156  */
00157 enum {
00158     PROVIDER_ACKNOWLEDGEMENT = 0,
00159     USER_ACKNOWLEDGEMENT = 1
00160 };
00161 
00162 /*
00163  * Who is indicating, wtp initiator or responder.
00164  */
00165 enum {
00166     INITIATOR_INDICATION = 0,
00167     RESPONDER_INDICATION = 1 
00168 };
00169 
00170 enum {
00171     TPI_ERROR = 0,
00172     TPI_INFO = 1,
00173     TPI_OPTION = 2,
00174     TPI_PSN = 3,
00175     TPI_SDU_BOUNDARY = 4,
00176     TPI_FRAME_BOUNDARY = 5
00177 };
00178 
00179 /*
00180  * Responder set first tid, initiator not. So all tids send by initiator are 
00181  * greater than 2**15.
00182  */
00183 #define INITIATOR_TID_LIMIT (1 << 15)
00184 
00185 /*
00186  *  Transaction is identified by the address four-tuple and tid.
00187  */
00188 struct machine_pattern {
00189     WAPAddrTuple *tuple;
00190     long tid;
00191     long mid;
00192 };
00193 
00194 typedef struct machine_pattern machine_pattern;
00195 
00196 /*
00197  * Handles possible concatenated messages. Returns a list of wap events, 
00198  * consisting of these events. 
00199  */
00200 List *wtp_unpack_wdp_datagram(WAPEvent *datagram);
00201 
00202 /*
00203  * Responder set the first bit of the tid field. If we get a packet from the 
00204  * responder, we are the initiator. 
00205  *
00206  * Returns 1 for responder, 0 for iniator and -1 for error.
00207  */
00208 int wtp_event_is_for_responder(WAPEvent *event);
00209 
00210 #endif
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.