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

wap_push_ppg.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  * Push PPG main module header
00059  *
00060  * This module implements following Wapforum specifications:
00061  *      WAP-151-PPGService-19990816-a (called afterwards ppg),
00062  *      WAP-164-PAP-19991108-a (pap),
00063  *      WAP-164_100-PAP-20000218-a (pap implementation note).
00064  * 
00065  * We refer following Wapforum specifications:
00066  *      WAP-145-PushMessage-19990816-a (push message)
00067  *      WAP-200-WDP-20001212-a (wdp)
00068  *      WAP-203-WSP-20000504-a (wsp)
00069  *      WAP-189-PushOTA-20000217-a (ota).
00070  *
00071  * In addition, rfcs 1521, 2045 and 2617 are referred.
00072  *
00073  * By Aarno Syvänen for Wapit Ltd and for Wiral Ltd.
00074  */
00075 
00076 #ifndef WAP_PUSH_PPG_H
00077 #define WAP_PUSH_PPG_H
00078 
00079 #include "wap/wap_events.h"
00080 #include "wap/wap.h"
00081 #include "wap/wap_addr.h"
00082 #include "gwlib/gwlib.h"
00083 
00084 typedef struct PPGSessionMachine PPGSessionMachine;
00085 typedef struct PPGPushMachine PPGPushMachine;
00086 
00087 /*
00088  * Enumerations used by PPG main module for PAP attribute, see PPG Services, 
00089  * Chapter 6.
00090  *
00091  * Message state
00092  */
00093 enum {
00094     PAP_UNDELIVERABLE,         /* general message status */
00095     PAP_UNDELIVERABLE1,        /* transformation failure */
00096     PAP_UNDELIVERABLE2,        /* no bearer support */
00097     PAP_PENDING,
00098     PAP_EXPIRED,
00099     PAP_DELIVERED,             /* general message status */
00100     PAP_DELIVERED1,            /* for unconfirmed push, PPG internal */
00101     PAP_DELIVERED2,            /* for confirmed push, PPG internal  */
00102     PAP_ABORTED,
00103     PAP_TIMEOUT,
00104     PAP_CANCELLED
00105 };
00106 
00107 /*
00108  * PAP protocol status codes used by PPG main module. See Push Access Protocol,
00109  * 9.13 and 9.14. 
00110  */
00111 enum {
00112     PAP_OK = 1000,
00113     PAP_ACCEPTED_FOR_PROCESSING = 1001,
00114     PAP_BAD_REQUEST = 2000, 
00115     PAP_FORBIDDEN = 2001,
00116     PAP_ADDRESS_ERROR = 2002,
00117     PAP_CAPABILITIES_MISMATCH = 2005,
00118     PAP_DUPLICATE_PUSH_ID = 2007,
00119     PAP_INTERNAL_SERVER_ERROR = 3000,
00120     PAP_TRANSFORMATION_FAILURE = 3006,
00121     PAP_REQUIRED_BEARER_NOT_AVAILABLE = 3010,
00122     PAP_SERVICE_FAILURE = 4000,
00123     PAP_CLIENT_ABORTED = 5000,
00124     PAP_ABORT_USERPND = 5028
00125 };
00126 
00127 /*
00128  * Values for last attribute (it is, is this message last using this bearer).
00129  */
00130 enum {
00131     NOT_LAST,
00132     LAST
00133 };
00134 
00135 /*
00136  * Enumerations used by PAP message fields, see Push Access Protocol, Chapter
00137  * 9. Default values are the first ones (ones having value 0)
00138  *
00139  * Simple answer to question is something required or not
00140  */
00141 enum {
00142     PAP_FALSE,
00143     PAP_TRUE
00144 };
00145 
00146 /*
00147  * Priority
00148  */
00149 enum {
00150     PAP_MEDIUM,
00151     PAP_HIGH,
00152     PAP_LOW
00153 };
00154 
00155 /*
00156  * Delivery method
00157  */
00158 enum {
00159     PAP_NOT_SPECIFIED = 0,
00160     PAP_PREFERCONFIRMED = 1,
00161     PAP_UNCONFIRMED = 2,
00162     PAP_CONFIRMED = 3
00163 };
00164 
00165 /*
00166  * Port number definitions
00167  */
00168 enum {
00169     CONNECTIONLESS_PUSH_CLIPORT = 2948,
00170     CONNECTIONLESS_SERVPORT = 9200,
00171     CONNECTED_CLIPORT = 9209,
00172     CONNECTED_SERVPORT = 9201
00173 };
00174 
00175 struct PPGSessionMachine {
00176     #define OCTSTR(name) Octstr *name;
00177     #define ADDRTUPLE(name) WAPAddrTuple *name;
00178     #define INTEGER(name) long name;
00179     #define PUSHMACHINES(name) List *name;
00180     #define CAPABILITIES(name) List *name;
00181     #define MACHINE(fields) fields
00182     #include "wap_ppg_session_machine.def"
00183 };
00184 
00185 struct PPGPushMachine {
00186     #define OCTSTR(name) Octstr *name;
00187     #define OPTIONAL_OCTSTR(name) Octstr *name;
00188     #define INTEGER(name) long name;
00189     #define ADDRTUPLE(name) WAPAddrTuple *name;
00190     #define HTTPHEADER(name) List *name;
00191     #define CAPABILITIES(name) List *name;
00192     #define MACHINE(fields) fields
00193     #include "wap_ppg_push_machine.def"
00194 };
00195 
00196 void wap_push_ppg_init(wap_dispatch_func_t *ota_dispatch,
00197                        wap_dispatch_func_t *appl_dispatch, Cfg *cfg);
00198 void wap_push_ppg_shutdown(void);
00199 void wap_push_ppg_dispatch_event(WAPEvent *e);
00200 
00201 /*
00202  * Check do we have established a session with an initiator for this push.
00203  * Initiators are identified by their address tuple (ppg main module does not
00204  * know wsp sessions until told. 
00205  */
00206 PPGSessionMachine *wap_push_ppg_have_push_session_for(WAPAddrTuple *tuple);
00207 
00208 /*
00209  * Now iniator are identified by their session id. This function is used after
00210  * the session is established.
00211  */
00212 PPGSessionMachine *wap_push_ppg_have_push_session_for_sid(long sid);
00213 
00214 #endif
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.