Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
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"

Go to the source code of this file.

Data Structures

struct  PPGSessionMachine
 
struct  PPGPushMachine
 

Macros

#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 struct PPGSessionMachine PPGSessionMachine
 
typedef struct 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)
 

Macro Definition 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

Definition at line 85 of file wap_push_ppg.h.

Definition at line 84 of file wap_push_ppg.h.

Enumeration Type Documentation

anonymous enum
Enumerator
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.

93  {
94  PAP_UNDELIVERABLE, /* general message status */
95  PAP_UNDELIVERABLE1, /* transformation failure */
96  PAP_UNDELIVERABLE2, /* no bearer support */
99  PAP_DELIVERED, /* general message status */
100  PAP_DELIVERED1, /* for unconfirmed push, PPG internal */
101  PAP_DELIVERED2, /* for confirmed push, PPG internal */
102  PAP_ABORTED,
103  PAP_TIMEOUT,
105 };
anonymous enum
Enumerator
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.

anonymous enum
Enumerator
NOT_LAST 
LAST 

Definition at line 130 of file wap_push_ppg.h.

130  {
131  NOT_LAST,
132  LAST
133 };
anonymous enum
Enumerator
PAP_FALSE 
PAP_TRUE 

Definition at line 141 of file wap_push_ppg.h.

141  {
142  PAP_FALSE,
143  PAP_TRUE
144 };
anonymous enum
Enumerator
PAP_MEDIUM 
PAP_HIGH 
PAP_LOW 

Definition at line 149 of file wap_push_ppg.h.

149  {
150  PAP_MEDIUM,
151  PAP_HIGH,
152  PAP_LOW
153 };
anonymous enum
Enumerator
PAP_NOT_SPECIFIED 
PAP_PREFERCONFIRMED 
PAP_UNCONFIRMED 
PAP_CONFIRMED 

Definition at line 158 of file wap_push_ppg.h.

anonymous enum
Enumerator
CONNECTIONLESS_PUSH_CLIPORT 
CONNECTIONLESS_SERVPORT 
CONNECTED_CLIPORT 
CONNECTED_SERVPORT 

Definition at line 168 of file wap_push_ppg.h.

Function Documentation

void wap_push_ppg_dispatch_event ( WAPEvent e)

Definition at line 476 of file wap_push_ppg.c.

References gw_assert(), gwlist_produce(), 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().

477 {
480 }
void gwlist_produce(List *list, void *item)
Definition: list.c:411
static List * ppg_queue
Definition: wap_push_ppg.c:133
static enum @39 run_status
gw_assert(wtls_machine->packet_to_send!=NULL)
PPGSessionMachine* wap_push_ppg_have_push_session_for ( WAPAddrTuple tuple)

Definition at line 488 of file wap_push_ppg.c.

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

Referenced by handle_internal_event(), and main_thread().

489 {
490  PPGSessionMachine *sm;
491 
492  gw_assert(tuple);
494 
495  return sm;
496 }
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
Definition: list.c:486
Octstr * address
Definition: wap_addr.h:68
gw_assert(wtls_machine->packet_to_send!=NULL)
static int session_has_addr(void *a, void *b)
WAPAddr * remote
Definition: wap_addr.h:74
static List * ppg_machines
Definition: wap_push_ppg.c:143
PPGSessionMachine* wap_push_ppg_have_push_session_for_sid ( long  sid)

Definition at line 503 of file wap_push_ppg.c.

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

Referenced by handle_internal_event(), and main_thread().

504 {
505  PPGSessionMachine *sm;
506 
507  gw_assert(sid >= 0);
509 
510  return sm;
511 }
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
Definition: list.c:486
static int session_has_sid(void *a, void *b)
gw_assert(wtls_machine->packet_to_send!=NULL)
static List * ppg_machines
Definition: wap_push_ppg.c:143
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_open_port(), http_read_thread(), limbo, NO_HTTPS_PORT, number_of_pushes, ota_read_thread(), pap_request_thread(), ppg_port, read_ppg_config(), run_status, running, TYPE_HTTP, TYPE_HTTPS, user_configuration, and USER_CONFIGURATION_NOT_ADDED.

Referenced by main().

399 {
409 
410  dispatch_to_ota = ota_dispatch;
411  dispatch_to_appl = appl_dispatch;
412 
414 #ifdef HAVE_LIBSSL
415  if (ppg_ssl_port != NO_HTTPS_PORT)
416  http_open_port(ppg_ssl_port, TYPE_HTTPS);
417 #endif
420 
425 #ifdef HAVE_LIBSSL
426  if (ppg_ssl_port != NO_HTTPS_PORT)
427  gwthread_create(https_read_thread, NULL);
428 #endif
430  }
431 }
Dict * dict_create(long size_hint, void(*destroy_value)(void *))
Definition: dict.c:192
static int read_ppg_config(Cfg *cfg)
Definition: wap_push_ppg.c:523
static Counter * push_id_counter
Definition: wap_push_ppg.c:154
static void http_read_thread(void *arg)
Definition: wap_push_ppg.c:688
static List * ppg_queue
Definition: wap_push_ppg.c:133
static enum @39 run_status
static List * ppg_unit_pushes
Definition: wap_push_ppg.c:149
static int user_configuration
Definition: wap_push_ppg.c:196
static Dict * urls
Definition: wap_push_ppg.c:165
static Dict * http_clients
Definition: wap_push_ppg.c:160
Counter * counter_create(void)
Definition: counter.c:94
static long ppg_port
Definition: wap_push_ppg.c:185
static wap_dispatch_func_t * dispatch_to_ota
Definition: wap_push_ppg.c:176
#define gwthread_create(func, arg)
Definition: gwthread.h:90
gw_assert(wtls_machine->packet_to_send!=NULL)
static void ota_read_thread(void *arg)
Definition: wap_push_ppg.c:634
int http_open_port(int port, int ssl)
Definition: http.c:2498
static long number_of_pushes
Definition: wap_push_ppg.c:191
static void pap_request_thread(void *arg)
Definition: wap_push_ppg.c:746
static wap_dispatch_func_t * dispatch_to_appl
Definition: wap_push_ppg.c:177
#define gwlist_create()
Definition: list.h:136
static List * pap_queue
Definition: wap_push_ppg.c:138
void gwlist_add_producer(List *list)
Definition: list.c:383
static List * ppg_machines
Definition: wap_push_ppg.c:143
void wap_push_ppg_shutdown ( void  )

Definition at line 433 of file wap_push_ppg.c.

References counter_destroy(), debug(), dict_destroy(), gw_assert(), gwlist_destroy(), gwlist_len(), gwlist_remove_producer(), gwthread_join_every(), http_close_all_ports(), http_read_thread(), NO_HTTPS_PORT, octstr_destroy(), ota_read_thread(), pap_event_destroy_item(), pap_request_thread(), push_machine_destroy(), run_status, running, session_machine_destroy(), terminating, user_configuration, USER_CONFIGURATION_NOT_ADDED, wap_event_destroy_item(), and wap_push_ppg_pushuser_list_destroy().

Referenced by main().

434 {
441  ppg_url = NULL;
453 
455 #ifdef HAVE_LIBSSL
456  if (ppg_ssl_port != NO_HTTPS_PORT)
457  gwthread_join_every(https_read_thread);
458 #endif
461 
465 
466  debug("wap.push.ppg", 0, "PPG: %ld push session machines left.",
469 
470  debug("wap_push_ppg", 0, "PPG: %ld unit pushes left",
473  }
474 }
static Octstr * service_name
Definition: wap_push_ppg.c:205
static Octstr * ppg_default_smsc
Definition: wap_push_ppg.c:198
void counter_destroy(Counter *counter)
Definition: counter.c:110
static Counter * push_id_counter
Definition: wap_push_ppg.c:154
long gwlist_len(List *list)
Definition: list.c:166
static Octstr * ppg_url
Definition: wap_push_ppg.c:184
static void http_read_thread(void *arg)
Definition: wap_push_ppg.c:688
static List * ppg_queue
Definition: wap_push_ppg.c:133
static enum @39 run_status
static Octstr * ppg_dlr_url
Definition: wap_push_ppg.c:203
static List * ppg_unit_pushes
Definition: wap_push_ppg.c:149
void gwthread_join_every(gwthread_func_t *func)
static int user_configuration
Definition: wap_push_ppg.c:196
static Octstr * ppg_allow_ip
Definition: wap_push_ppg.c:195
static Dict * urls
Definition: wap_push_ppg.c:165
static Dict * http_clients
Definition: wap_push_ppg.c:160
static Octstr * global_sender
Definition: wap_push_ppg.c:197
void gwlist_remove_producer(List *list)
Definition: list.c:401
void wap_event_destroy_item(void *event)
Definition: wap_events.c:130
void wap_push_ppg_pushuser_list_destroy(void)
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:322
static void pap_event_destroy_item(void *p)
Definition: wap_push_ppg.c:671
gw_assert(wtls_machine->packet_to_send!=NULL)
static void ota_read_thread(void *arg)
Definition: wap_push_ppg.c:634
void http_close_all_ports(void)
Definition: http.c:2515
void dict_destroy(Dict *dict)
Definition: dict.c:215
static void pap_request_thread(void *arg)
Definition: wap_push_ppg.c:746
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:690
static Octstr * ppg_smsbox_id
Definition: wap_push_ppg.c:204
static void push_machine_destroy(void *pm)
static List * pap_queue
Definition: wap_push_ppg.c:138
static Octstr * ppg_deny_ip
Definition: wap_push_ppg.c:194
static void session_machine_destroy(void *p)
static List * ppg_machines
Definition: wap_push_ppg.c:143
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.