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

wap_push_ppg.h File Reference

#include "wap/wap_events.h"
#include "wap/wap.h"
#include "wap/wap_addr.h"
#include "gwlib/gwlib.h"
#include "wap_ppg_session_machine.def"
#include "wap_ppg_push_machine.def"

Include dependency graph for wap_push_ppg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  PPGSessionMachine
struct  PPGPushMachine

Defines

#define OCTSTR(name)   Octstr *name;
#define ADDRTUPLE(name)   WAPAddrTuple *name;
#define INTEGER(name)   long name;
#define PUSHMACHINES(name)   List *name;
#define CAPABILITIES(name)   List *name;
#define MACHINE(fields)   fields
#define OCTSTR(name)   Octstr *name;
#define OPTIONAL_OCTSTR(name)   Octstr *name;
#define INTEGER(name)   long name;
#define ADDRTUPLE(name)   WAPAddrTuple *name;
#define HTTPHEADER(name)   List *name;
#define CAPABILITIES(name)   List *name;
#define MACHINE(fields)   fields

Typedefs

typedef PPGSessionMachine PPGSessionMachine
typedef PPGPushMachine PPGPushMachine

Enumerations

enum  {
  PAP_UNDELIVERABLE, PAP_UNDELIVERABLE1, PAP_UNDELIVERABLE2, PAP_PENDING,
  PAP_EXPIRED, PAP_DELIVERED, PAP_DELIVERED1, PAP_DELIVERED2,
  PAP_ABORTED, PAP_TIMEOUT, PAP_CANCELLED
}
enum  {
  PAP_OK = 1000, PAP_ACCEPTED_FOR_PROCESSING = 1001, PAP_BAD_REQUEST = 2000, PAP_FORBIDDEN = 2001,
  PAP_ADDRESS_ERROR = 2002, PAP_CAPABILITIES_MISMATCH = 2005, PAP_DUPLICATE_PUSH_ID = 2007, PAP_INTERNAL_SERVER_ERROR = 3000,
  PAP_TRANSFORMATION_FAILURE = 3006, PAP_REQUIRED_BEARER_NOT_AVAILABLE = 3010, PAP_SERVICE_FAILURE = 4000, PAP_CLIENT_ABORTED = 5000,
  PAP_ABORT_USERPND = 5028
}
enum  { NOT_LAST, LAST }
enum  { PAP_FALSE, PAP_TRUE }
enum  { PAP_MEDIUM, PAP_HIGH, PAP_LOW }
enum  { PAP_NOT_SPECIFIED = 0, PAP_PREFERCONFIRMED = 1, PAP_UNCONFIRMED = 2, PAP_CONFIRMED = 3 }
enum  { CONNECTIONLESS_PUSH_CLIPORT = 2948, CONNECTIONLESS_SERVPORT = 9200, CONNECTED_CLIPORT = 9209, CONNECTED_SERVPORT = 9201 }

Functions

void wap_push_ppg_init (wap_dispatch_func_t *ota_dispatch, wap_dispatch_func_t *appl_dispatch, Cfg *cfg)
void wap_push_ppg_shutdown (void)
void wap_push_ppg_dispatch_event (WAPEvent *e)
PPGSessionMachinewap_push_ppg_have_push_session_for (WAPAddrTuple *tuple)
PPGSessionMachinewap_push_ppg_have_push_session_for_sid (long sid)


Define Documentation

#define ADDRTUPLE name   )     WAPAddrTuple *name;
 

Definition at line 189 of file wap_push_ppg.h.

#define ADDRTUPLE name   )     WAPAddrTuple *name;
 

Definition at line 189 of file wap_push_ppg.h.

#define CAPABILITIES name   )     List *name;
 

Definition at line 191 of file wap_push_ppg.h.

#define CAPABILITIES name   )     List *name;
 

Definition at line 191 of file wap_push_ppg.h.

#define HTTPHEADER name   )     List *name;
 

Definition at line 190 of file wap_push_ppg.h.

#define INTEGER name   )     long name;
 

Definition at line 188 of file wap_push_ppg.h.

#define INTEGER name   )     long name;
 

Definition at line 188 of file wap_push_ppg.h.

#define MACHINE fields   )     fields
 

Definition at line 192 of file wap_push_ppg.h.

#define MACHINE fields   )     fields
 

Definition at line 192 of file wap_push_ppg.h.

#define OCTSTR name   )     Octstr *name;
 

Definition at line 186 of file wap_push_ppg.h.

#define OCTSTR name   )     Octstr *name;
 

Definition at line 186 of file wap_push_ppg.h.

#define OPTIONAL_OCTSTR name   )     Octstr *name;
 

Definition at line 187 of file wap_push_ppg.h.

#define PUSHMACHINES name   )     List *name;
 

Definition at line 179 of file wap_push_ppg.h.


Typedef Documentation

typedef struct PPGPushMachine PPGPushMachine
 

Definition at line 85 of file wap_push_ppg.h.

typedef struct PPGSessionMachine PPGSessionMachine
 

Definition at line 84 of file wap_push_ppg.h.


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
PAP_UNDELIVERABLE 
PAP_UNDELIVERABLE1 
PAP_UNDELIVERABLE2 
PAP_PENDING 
PAP_EXPIRED 
PAP_DELIVERED 
PAP_DELIVERED1 
PAP_DELIVERED2 
PAP_ABORTED 
PAP_TIMEOUT 
PAP_CANCELLED 

Definition at line 93 of file wap_push_ppg.h.

00093      {
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 };

anonymous enum
 

Enumeration values:
PAP_OK 
PAP_ACCEPTED_FOR_PROCESSING 
PAP_BAD_REQUEST 
PAP_FORBIDDEN 
PAP_ADDRESS_ERROR 
PAP_CAPABILITIES_MISMATCH 
PAP_DUPLICATE_PUSH_ID 
PAP_INTERNAL_SERVER_ERROR 
PAP_TRANSFORMATION_FAILURE 
PAP_REQUIRED_BEARER_NOT_AVAILABLE 
PAP_SERVICE_FAILURE 
PAP_CLIENT_ABORTED 
PAP_ABORT_USERPND 

Definition at line 111 of file wap_push_ppg.h.

00111      {
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 };

anonymous enum
 

Enumeration values:
NOT_LAST 
LAST 

Definition at line 130 of file wap_push_ppg.h.

00130      {
00131     NOT_LAST,
00132     LAST
00133 };

anonymous enum
 

Enumeration values:
PAP_FALSE 
PAP_TRUE 

Definition at line 141 of file wap_push_ppg.h.

00141      {
00142     PAP_FALSE,
00143     PAP_TRUE
00144 };

anonymous enum
 

Enumeration values:
PAP_MEDIUM 
PAP_HIGH 
PAP_LOW 

Definition at line 149 of file wap_push_ppg.h.

00149      {
00150     PAP_MEDIUM,
00151     PAP_HIGH,
00152     PAP_LOW
00153 };

anonymous enum
 

Enumeration values:
PAP_NOT_SPECIFIED 
PAP_PREFERCONFIRMED 
PAP_UNCONFIRMED 
PAP_CONFIRMED 

Definition at line 158 of file wap_push_ppg.h.

00158      {
00159     PAP_NOT_SPECIFIED = 0,
00160     PAP_PREFERCONFIRMED = 1,
00161     PAP_UNCONFIRMED = 2,
00162     PAP_CONFIRMED = 3
00163 };

anonymous enum
 

Enumeration values:
CONNECTIONLESS_PUSH_CLIPORT 
CONNECTIONLESS_SERVPORT 
CONNECTED_CLIPORT 
CONNECTED_SERVPORT 

Definition at line 168 of file wap_push_ppg.h.

00168      {
00169     CONNECTIONLESS_PUSH_CLIPORT = 2948,
00170     CONNECTIONLESS_SERVPORT = 9200,
00171     CONNECTED_CLIPORT = 9209,
00172     CONNECTED_SERVPORT = 9201
00173 };


Function Documentation

void wap_push_ppg_dispatch_event WAPEvent e  ) 
 

Definition at line 473 of file wap_push_ppg.c.

References gw_assert, gwlist_produce(), ppg_queue, run_status, and running.

Referenced by confirm_push(), indicate_push_abort(), indicate_push_connection(), indicate_push_disconnect(), indicate_push_resume(), indicate_push_suspend(), and main().

00474 {
00475     gw_assert(run_status == running);
00476     gwlist_produce(ppg_queue, e);
00477 }

Here is the call graph for this function:

PPGSessionMachine* wap_push_ppg_have_push_session_for WAPAddrTuple tuple  ) 
 

Definition at line 485 of file wap_push_ppg.c.

References WAPAddr::address, gw_assert, gwlist_search(), ppg_machines, WAPAddrTuple::remote, session_has_addr(), and sm.

Referenced by handle_internal_event(), and main_thread().

00486 {
00487     PPGSessionMachine *sm;
00488 
00489     gw_assert(tuple);
00490     sm = gwlist_search(ppg_machines, tuple->remote->address, session_has_addr);
00491 
00492     return sm;
00493 }

Here is the call graph for this function:

PPGSessionMachine* wap_push_ppg_have_push_session_for_sid long  sid  ) 
 

Definition at line 500 of file wap_push_ppg.c.

References gw_assert, gwlist_search(), ppg_machines, session_has_sid(), and sm.

Referenced by handle_internal_event(), and main_thread().

00501 {
00502     PPGSessionMachine *sm;
00503 
00504     gw_assert(sid >= 0);
00505     sm = gwlist_search(ppg_machines, &sid, session_has_sid);
00506 
00507     return sm;
00508 }

Here is the call graph for this function:

void wap_push_ppg_init wap_dispatch_func_t ota_dispatch,
wap_dispatch_func_t appl_dispatch,
Cfg cfg
 

Definition at line 397 of file wap_push_ppg.c.

References counter_create(), dict_create(), dispatch_to_appl, dispatch_to_ota, gw_assert, gwlist_add_producer(), gwlist_create, gwthread_create, http_clients, http_open_port(), http_read_thread(), https_read_thread(), limbo, number_of_pushes, ota_read_thread(), pap_queue, pap_request_thread(), ppg_machines, ppg_port, ppg_queue, ppg_ssl_port, ppg_unit_pushes, push_id_counter, read_ppg_config(), run_status, TYPE_HTTP, TYPE_HTTPS, urls, and user_configuration.

Referenced by main().

00399 {
00400     user_configuration = read_ppg_config(cfg);
00401     if (user_configuration != USER_CONFIGURATION_NOT_ADDED) {
00402         ppg_queue = gwlist_create();
00403         gwlist_add_producer(ppg_queue);
00404         pap_queue = gwlist_create();
00405         gwlist_add_producer(pap_queue);
00406         push_id_counter = counter_create();
00407         ppg_machines = gwlist_create();
00408         ppg_unit_pushes = gwlist_create();
00409 
00410         dispatch_to_ota = ota_dispatch;
00411         dispatch_to_appl = appl_dispatch;
00412 
00413         http_open_port(ppg_port, TYPE_HTTP);
00414 #ifdef HAVE_LIBSSL
00415         if (ppg_ssl_port != NO_HTTPS_PORT)
00416             http_open_port(ppg_ssl_port, TYPE_HTTPS);
00417 #endif
00418         http_clients = dict_create(number_of_pushes, NULL);
00419         urls = dict_create(number_of_pushes, NULL);
00420 
00421         gw_assert(run_status == limbo);
00422         run_status = running;
00423         gwthread_create(ota_read_thread, NULL);
00424         gwthread_create(http_read_thread, NULL);
00425 #ifdef HAVE_LIBSSL
00426         if (ppg_ssl_port != NO_HTTPS_PORT) 
00427             gwthread_create(https_read_thread, NULL);
00428 #endif
00429         gwthread_create(pap_request_thread, NULL);
00430     }
00431 }

Here is the call graph for this function:

void wap_push_ppg_shutdown void   ) 
 

Definition at line 433 of file wap_push_ppg.c.

References counter_destroy(), debug(), dict_destroy(), global_sender, gw_assert, gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), http_clients, http_close_all_ports(), http_read_thread(), https_read_thread(), octstr_destroy(), ota_read_thread(), pap_event_destroy_item(), pap_queue, pap_request_thread(), ppg_allow_ip, ppg_default_smsc, ppg_deny_ip, ppg_machines, ppg_queue, ppg_ssl_port, ppg_unit_pushes, ppg_url, push_id_counter, push_machine_destroy(), run_status, running, service_name, session_machine_destroy(), urls, user_configuration, wap_event_destroy_item(), and wap_push_ppg_pushuser_list_destroy().

Referenced by main().

00434 {
00435      if (user_configuration != USER_CONFIGURATION_NOT_ADDED) {
00436          gw_assert(run_status == running);
00437          run_status = terminating;
00438          gwlist_remove_producer(ppg_queue);
00439          gwlist_remove_producer(pap_queue);
00440          octstr_destroy(ppg_url);
00441          http_close_all_ports();
00442          dict_destroy(http_clients);
00443          dict_destroy(urls);
00444          wap_push_ppg_pushuser_list_destroy();
00445          octstr_destroy(ppg_deny_ip);
00446          octstr_destroy(ppg_allow_ip);
00447          octstr_destroy(global_sender);
00448          octstr_destroy(service_name);
00449          octstr_destroy(ppg_default_smsc);
00450 
00451          gwthread_join_every(http_read_thread);
00452 #ifdef HAVE_LIBSSL
00453          if (ppg_ssl_port != NO_HTTPS_PORT)
00454             gwthread_join_every(https_read_thread);
00455 #endif
00456          gwthread_join_every(ota_read_thread);
00457          gwthread_join_every(pap_request_thread);
00458 
00459          gwlist_destroy(ppg_queue, wap_event_destroy_item);
00460          gwlist_destroy(pap_queue, pap_event_destroy_item);
00461          counter_destroy(push_id_counter);
00462      
00463          debug("wap.push.ppg", 0, "PPG: %ld push session machines left.",
00464                gwlist_len(ppg_machines));
00465          gwlist_destroy(ppg_machines, session_machine_destroy);
00466 
00467          debug("wap_push_ppg", 0, "PPG: %ld unit pushes left", 
00468                gwlist_len(ppg_unit_pushes));
00469          gwlist_destroy(ppg_unit_pushes, push_machine_destroy);
00470      }
00471 }

Here is the call graph for this function:

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.