113 #define DEFAULT_PPG_URL "/wappush" 200 static Octstr *ssl_server_cert_file = NULL;
201 static Octstr *ssl_server_key_file = NULL;
229 static void https_read_thread(
void *arg);
466 debug(
"wap.push.ppg", 0,
"PPG: %ld push session machines left.",
470 debug(
"wap_push_ppg", 0,
"PPG: %ld unit pushes left",
553 if (ssl_server_cert_file == NULL || ssl_server_key_file == NULL)
554 panic(0,
"cannot continue without server cert and/or key files");
555 conn_use_global_server_certkey_file(ssl_server_cert_file, ssl_server_key_file);
570 panic(0,
"No user group but ppg not trusted, stopping");
578 panic(0,
"unable to create users configuration list, exiting");
595 warning(0,
"Your ppg core configuration lacks allowed and denied" 602 panic(0,
"Your ppg core configuration deny all ips, exiting");
608 warning(0,
"Your ppg core configuration allow all ips");
615 error(0,
"ip found from denied list");
622 debug(
"wap.push.ppg.pushuser", 0,
"PPG: ip_allowed_by_ppg: ip found" 623 " from allowed list");
627 warning(0,
"did not found ip from any of core lists, deny it");
711 static void https_read_thread(
void *arg)
751 Octstr *pap_content = NULL;
753 Octstr *rdf_content = NULL;
783 error(0,
"Request <%s> from <%s>: service not found",
785 debug(
"wap.push.ppg", 0,
"your configuration uses %s",
787 not_found =
octstr_imm(
"Service not specified\n");
795 error(0,
"Request <%s> from <%s>: ip forbidden, closing the" 804 error(0,
"Request <%s> from <%s>: authorisation failure",
817 warning(0,
"PPG: No MIME content received, the request" 827 warning(0,
"PPG: No push headers received , the request" 842 warning(0,
"PPG: Unparsable push headers, the request" 852 warning(0,
"PPG: No MIME boundary, the request unacceptable");
862 &content_headers, &rdf_content)) {
867 warning(0,
"PPG: unable to parse mime content, the request" 871 debug(
"wap.push.ppg", 0,
"PPG: http_read_thread: pap multipart" 885 if ((compiler_status =
pap_compile(pap_content, &ppg_event)) == -2) {
890 warning(0,
"PPG: pap control entity erroneous, the request" 893 }
else if (compiler_status == -1) {
898 warning(0,
"PPG: non implemented pap feature requested, the" 899 " request unacceptable");
903 ppg_event->
u.Push_Message.pi_push_id,
client)) {
904 warning(0,
"PPG: duplicate push id, the request unacceptable");
917 username, ppg_event->
u.Push_Message.address_value)) {
926 debug(
"wap.push.ppg", 0,
"PPG: http_read_thread: pap control" 927 " entity compiled ok");
932 ppg_event->
u.Push_Message.dlr_url =
dlr_url;
1061 message_transformable,
1064 long coded_appid_value;
1075 cliaddr = e->
u.Push_Message.address_value;
1084 if (!sm && !cless) {
1089 warning(0,
"PPG: handle_push_message: duplicate push id");
1094 if (!message_transformable) {
1101 goto no_transformation;
1108 if (!bearer_supported) {
1129 info(0,
"PPG: handle_push_message: push message accepted for processing");
1141 goto unit_push_delivered;
1144 if (session_exists) {
1150 if (coriented_possible) {
1153 warning(0,
"PPG: handle_push_message: wrong app id for confirmed" 1154 " push session creation");
1165 unit_push_delivered:
1219 case Pom_Connect_Ind:
1220 debug(
"wap.push.ppg", 0,
"PPG: handle_internal_event: connect" 1221 " indication from OTA");
1222 sid = e->
u.Pom_Connect_Ind.session_id;
1223 tuple = e->
u.Pom_Connect_Ind.addr_tuple;
1225 caps = e->
u.Pom_Connect_Ind.requested_capabilities;
1243 case Pom_Disconnect_Ind:
1244 debug(
"wap.push.ppg", 0,
"PPG: handle_internal_event: disconnect" 1245 " indication from OTA");
1247 e->
u.Pom_Disconnect_Ind.session_handle);
1258 case Po_ConfirmedPush_Cnf:
1259 debug(
"wap.push.ppg", 0,
"PPG: handle_internal_event: push" 1260 " confirmation from OTA");
1261 sid = e->
u.Po_ConfirmedPush_Cnf.session_handle;
1262 pid = e->
u.Po_ConfirmedPush_Cnf.server_push_id;
1275 case Po_PushAbort_Ind:
1276 debug(
"wap.push.ppg", 0,
"PPG: handle_internal_event: abort" 1277 " indication from OTA");
1278 sid = e->
u.Po_PushAbort_Ind.session_handle;
1279 pid = e->
u.Po_PushAbort_Ind.push_id;
1285 reason = e->
u.Po_PushAbort_Ind.reason;
1295 debug(
"wap.ppg", 0,
"PPG: handle_internal_event: an unhandled event");
1316 #define INTEGER(name) m->name = 0; 1317 #define OCTSTR(name) m->name = NULL; 1318 #define ADDRTUPLE(name) m->name = NULL; 1319 #define PUSHMACHINES(name) m->name = gwlist_create(); 1320 #define CAPABILITIES(name) m->name = NULL; 1321 #define MACHINE(fields) fields 1326 m->assumed_capabilities =
1331 debug(
"wap.push.ppg", 0,
"PPG: Created PPGSessionMachine %ld",
1345 debug(
"wap.push.ppg", 0,
"PPG: destroying PPGSEssionMachine %ld",
1348 #define OCTSTR(name) octstr_destroy(sm->name); 1349 #define ADDRTUPLE(name) wap_addr_tuple_destroy(sm->name); 1350 #define INTEGER(name) sm->name = 0; 1351 #define PUSHMACHINES(name) push_machines_list_destroy(sm->name); 1352 #define CAPABILITIES(name) wsp_cap_destroy_list(sm->name); 1353 #define MACHINE(fields) fields 1368 #define INTEGER(name) m->name = 0; 1369 #define OCTSTR(name) m->name = NULL; 1370 #define OPTIONAL_OCTSTR(name) m->name = NULL; 1371 #define ADDRTUPLE(name) m->name = NULL; 1372 #define CAPABILITIES m->name = NULL; 1373 #define HTTPHEADER(name) m->name = NULL; 1374 #define MACHINE(fields) fields 1380 m->delivery_method = e->
u.Push_Message.delivery_method;
1381 m->deliver_after_timestamp =
1383 m->priority = e->
u.Push_Message.priority;
1387 m->address_type = e->
u.Push_Message.address_type;
1388 if (e->
u.Push_Message.smsc_id != NULL)
1392 if (e->
u.Push_Message.dlr_url != NULL)
1396 m->dlr_mask = e->
u.Push_Message.dlr_mask;
1397 if (e->
u.Push_Message.smsbox_id != NULL)
1400 m->smsbox_id = NULL;
1403 m->progress_notes_requested = e->
u.Push_Message.progress_notes_requested;
1404 if (e->
u.Push_Message.progress_notes_requested)
1405 m->ppg_notify_requested_to =
1408 debug(
"wap.push.ppg", 0,
"PPG: push machine %ld created", m->push_id);
1426 debug(
"wap.push.ppg", 0,
"PPG: destroying push machine %ld",
1428 #define OCTSTR(name) octstr_destroy(pm->name); 1429 #define OPTIONAL_OCTSTR(name) octstr_destroy(pm->name); 1430 #define INTEGER(name) 1431 #define ADDRTUPLE(name) wap_addr_tuple_destroy(pm->name); 1432 #define CAPABILITIES(name) wap_cap_destroy_list(pm->name); 1433 #define HTTPHEADER(name) http_destroy_headers(pm->name); 1434 #define MACHINE(fields) fields 1442 if (machines == NULL)
1456 return octstr_compare(sm->addr_tuple->remote->address, cliaddr) == 0;
1467 return *sid == sm->session_id;
1495 ota_event->
u.Pom_SessionRequest_Req.addr_tuple =
1498 ota_event->
u.Pom_SessionRequest_Req.push_headers =
push_headers;
1499 ota_event->
u.Pom_SessionRequest_Req.push_id = pm->push_id;
1500 ota_event->
u.Pom_SessionRequest_Req.address_type = pm->address_type;
1502 ota_event->
u.Pom_SessionRequest_Req.smsc_id =
smsc_id;
1504 ota_event->
u.Pom_SessionRequest_Req.smsc_id = NULL;
1506 ota_event->
u.Pom_SessionRequest_Req.dlr_url =
dlr_url;
1508 ota_event->
u.Pom_SessionRequest_Req.dlr_url = NULL;
1509 ota_event->
u.Pom_SessionRequest_Req.dlr_mask = e->
u.Push_Message.dlr_mask;
1511 ota_event->
u.Pom_SessionRequest_Req.smsbox_id =
smsbox_id;
1513 ota_event->
u.Pom_SessionRequest_Req.smsbox_id = NULL;
1514 ota_event->
u.Pom_SessionRequest_Req.service_name =
service_name;
1536 ota_event->
u.Po_ConfirmedPush_Req.server_push_id = pm->push_id;
1537 ota_event->
u.Po_ConfirmedPush_Req.push_headers =
push_headers;
1538 ota_event->
u.Po_ConfirmedPush_Req.authenticated = pm->authenticated;
1539 ota_event->
u.Po_ConfirmedPush_Req.trusted = pm->trusted;
1540 ota_event->
u.Po_ConfirmedPush_Req.last = last;
1542 if (pm->push_data != NULL)
1543 ota_event->
u.Po_ConfirmedPush_Req.push_body =
1546 ota_event->
u.Po_ConfirmedPush_Req.push_body = NULL;
1548 ota_event->
u.Po_ConfirmedPush_Req.session_handle = sm->session_id;
1549 debug(
"wap.push.ota", 0,
"PPG: confirmed push request to OTA");
1569 ota_event->
u.Po_Unit_Push_Req.addr_tuple =
1571 ota_event->
u.Po_Unit_Push_Req.push_id = pm->push_id;
1573 ota_event->
u.Po_Unit_Push_Req.authenticated = pm->authenticated;
1574 ota_event->
u.Po_Unit_Push_Req.trusted = pm->trusted;
1575 ota_event->
u.Po_Unit_Push_Req.last = last;
1577 ota_event->
u.Po_Unit_Push_Req.address_type = pm->address_type;
1578 if (pm->smsc_id != NULL)
1581 ota_event->
u.Po_Unit_Push_Req.smsc_id = NULL;
1582 if (pm->dlr_url != NULL)
1585 ota_event->
u.Po_Unit_Push_Req.dlr_url = NULL;
1586 ota_event->
u.Po_Unit_Push_Req.dlr_mask = pm->dlr_mask;
1587 if (pm->smsbox_id != NULL)
1590 ota_event->
u.Po_Unit_Push_Req.smsbox_id = NULL;
1591 if (pm->service_name != NULL)
1592 ota_event->
u.Po_Unit_Push_Req.service_name =
octstr_duplicate(pm->service_name);
1597 debug(
"wap.push.ppg", 0,
"PPG: OTA request for unit push");
1612 ota_event->
u.Po_Push_Req.authenticated = pm->authenticated;
1613 ota_event->
u.Po_Push_Req.trusted = pm->trusted;
1614 ota_event->
u.Po_Push_Req.last = last;
1616 if (pm->push_data != NULL)
1617 ota_event->
u.Po_Push_Req.push_body =
1620 ota_event->
u.Po_Push_Req.push_body = NULL;
1622 ota_event->
u.Po_Push_Req.session_handle = pm->session_id;
1623 debug(
"wap.push.ppg", 0,
"PPG: OTA request for push");
1652 e->
u.Pom_Connect_Ind.requested_capabilities,
1653 sm->assumed_capabilities) == 0)
1657 appl_event->
u.Pom_Connect_Res.negotiated_capabilities =
1659 appl_event->
u.Pom_Connect_Res.session_id = e->
u.Pom_Connect_Ind.session_id;
1681 e->
u.Push_Response.reply_time =
set_time();
1682 e->
u.Push_Response.code =
code;
1711 current_time =
octstr_format(
"%04d-%02d-%02dT%02d:%02d:%02dZ",
1712 now.tm_year + 1900, now.tm_mon + 1,
1713 now.tm_mday, now.tm_hour, now.tm_min,
1716 return current_time;
1734 gw_assert(pm->trusted == 1 || pm->trusted == 0);
1735 gw_assert(pm->authenticated == 1 || pm->authenticated == 0);
1764 int message_deliverable;
1772 if ((**e).u.Push_Message.push_headers == NULL)
1775 cliaddr = (**e).u.Push_Message.address_value;
1776 push_headers = (**e).u.Push_Message.push_headers;
1802 debug(
"wap.push.ppg", 0,
"PPG: Content-Transfer-Encoding is \"%s\"",
1806 if (message_deliverable) {
1821 if (message_deliverable) {
1830 debug(
"wap.push.ppg", 0,
"PPG: transform_message: push message content" 1831 " and headers valid");
1835 warning(0,
"PPG: transform_message: no push headers, cannot accept");
1840 warning(0,
"PPG: transform_message: push content erroneous, cannot" 1847 warning(0,
"PPG: transform_message: push content non transformable");
1864 if (*push_headers == NULL)
1868 "X-WAP-Application-Id");
1870 if (appid_content == NULL) {
1880 if (coded_value == 2) {
1901 List *cache_directives;
1943 warning(0,
"PPG: wml compilation failed");
1953 warning(0,
"PPG: si compilation failed");
1963 warning(0,
"PPG: sl compilation failed");
1980 {
"text/vnd.wap.wml",
1981 "application/vnd.wap.wmlc",
1983 {
"text/vnd.wap.si",
1984 "application/vnd.wap.sic",
1986 {
"text/vnd.wap.sl",
1987 "application/vnd.wap.slc",
1991 #define NUM_CONVERTERS ((long) (sizeof(converters) / sizeof(converters[0]))) 2001 #define NUM_EXTRACTORS ((long) (sizeof(extractors) / sizeof(extractors[0]))) 2016 if (new_body == NULL)
2044 if (new_body == NULL)
2070 #define NUMBER_OF_BEARERS sizeof(bearers)/sizeof(bearers[0]) 2084 #define NUMBER_OF_NETWORKS sizeof(networks)/sizeof(networks[0]) 2096 int bearer_required,
2103 bearer_required = (**e).u.Push_Message.bearer_required;
2104 network_required = (**e).u.Push_Message.network_required;
2108 if (!bearer_required || !network_required)
2111 if (bearer_required)
2112 bearer = (**e).u.Push_Message.bearer;
2113 if (network_required)
2114 network = (**e).u.Push_Message.network;
2179 before = e->
u.Push_Message.deliver_before_timestamp;
2180 after = pm->deliver_after_timestamp;
2184 info(0,
"PPG: delivery deadline expired, dropping the push message");
2189 debug(
"wap.push.ppg", 0,
"PPG: too early to push the message," 2209 {
PAP_OK,
"The request succeeded"},
2216 " acceptable for the client specified"},
2219 " to an internal error"},
2229 " destination by the wsp"},
2233 " processed by the wsp"}
2286 int duplicate_push_id;
2290 pi_push_id = e->
u.Push_Message.pi_push_id;
2292 duplicate_push_id = 0;
2297 duplicate_push_id = 1;
2301 if (duplicate_push_id)
2302 return !duplicate_push_id;
2306 debug(
"wap.push.ppg", 0,
"PPG: store_push_data: push machine %ld" 2307 " appended to push list of sm machine %ld", (*pm)->push_id,
2311 debug(
"wap.push.ppg", 0,
"PPG: store_push_data: push machine %ld" 2312 " appended to unit push list", (*pm)->push_id);
2315 return !duplicate_push_id;
2340 if (!session_exists)
2347 info(0,
"PPG: unconfirmed push delivered to OTA");
2461 *session_exists = 0;
2463 *session_exists = 1;
2499 return *pid == pm->push_id;
2575 qm->message_state =
status;
2604 error(0,
"WAP_PUSH_PPG: update_push_data_with_attribute: Non" 2605 " existing push machine status: %ld",
status);
2631 m->session_id = sid;
2632 m->addr_tuple->remote->port =
port;
2672 return appid_code > -1;
2684 time_data[0] = now.tm_year + 1900;
2685 time_data[1] = now.tm_mon + 1;
2686 time_data[2] = now.tm_mday;
2687 time_data[3] = now.tm_hour;
2688 time_data[4] = now.tm_min;
2689 time_data[5] = now.tm_sec;
2699 if (data < time_data) {
2702 if (data > time_data) {
2727 for (j = 5; j <
octstr_len(before); j += 3) {
2817 "x-wap-microsoft:localcontent.ua",
2818 "x-wap-microsoft:IMclient.ua",
2819 "x-wap-docomo:imode.mail.ua",
2820 "x-wap-docomo:imode.mr.ua",
2821 "x-wap-docomo:imode.mf.ua",
2822 "x-motorola:location.ua",
2823 "x-motorola:now.ua",
2824 "x-motorola:otaprov.ua",
2825 "x-motorola:browser.ua",
2826 "x-motorola:splash.ua",
2827 "x-wap-nai:mvsw.command",
2828 "x-wap-openwave:iota.ua",
2829 "x-wap-docomo:imode.mail2.ua",
2830 "x-oma-nec:otaprov.ua",
2831 "x-oma-nokia:call.ua" 2834 #define NUMBER_OF_WINA_URIS sizeof(wina_uri)/sizeof(wina_uri[0]) 2873 if ((coded_value = wsp_string_to_application_id(*appid_content)) >= 0) {
2925 warning(0,
"PPG: headers_acceptable: got unacceptable push headers");
2970 warning(0,
"PPG: get_mime_boundary: no boundary specified");
2982 if (c ==
';' || (quoted && c ==
'"') || (!quoted && c ==
' '))
3036 "<?xml version=\"1.0\"?>" 3037 "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 1.0//EN\"" 3038 " \"http://www.wapforum.org/DTD/pap_1.0.dtd\">" 3040 "<badmessage-response code=\"");
3048 if (fragment != NULL &&
octstr_len(fragment) != 0) {
3055 "</badmessage-response>" 3058 debug(
"wap.push.ppg", 0,
"PPG: send_bad_message_response: telling pi");
3081 "<?xml version=\"1.0\"?>" 3082 "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 1.0//EN\"" 3083 " \"http://www.wapforum.org/DTD/pap_1.0.dtd\">" 3085 "<push-response push-id=\"");
3089 if (e->
u.Push_Response.sender_name != NULL) {
3093 e->
u.Push_Response.sender_name);
3097 if (e->
u.Push_Response.reply_time != NULL) {
3101 e->
u.Push_Response.reply_time);
3107 " sender-address=\"");
3113 "<response-result code =\"");
3117 if (e->
u.Push_Response.desc != NULL) {
3124 "</response-result>" 3133 debug(
"wap.push.ppg", 0,
"PPG: send_push_response: telling pi");
3155 "<?xml version=\"1.0\"?>" 3156 "<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 1.0//EN\"" 3157 " \"http://www.wapforum.org/DTD/pap_1.0.dtd\">" 3159 "<push-response push-id=\"");
3174 " sender-address=\"");
3179 "<response-result code =\"");
3188 "</response-result>" 3206 List *reply_headers;
3232 }
else if (c ==
'<') {
3234 }
else if (c ==
'>') {
3236 }
else if (c ==
'&') {
3321 if (dlrmaskos == NULL) {
3332 warning(0,
"unparsable dlr mask, rejected");
Dict * dict_create(long size_hint, void(*destroy_value)(void *))
static int headers_acceptable(List *push_headers, Octstr **content_header)
static int confirmation_requested(WAPEvent *e)
void error(int err, const char *fmt,...)
static void remove_x_kannel_headers(List **push_headers)
void info(int err, const char *fmt,...)
static int is_phone_number(long type_of_address)
static Octstr * escape_fragment(Octstr *fragment)
static Octstr * service_name
int sl_compile(Octstr *sl_doc, Octstr *charset, Octstr **sl_binary)
static int check_capabilities(List *requested, List *assumed)
Octstr * wap_push_ppg_pushuser_dlr_url_get(Octstr *username)
static Octstr * ppg_default_smsc
List * http_header_find_all(List *headers, char *name)
static int cless_accepted(WAPEvent *e, PPGSessionMachine *sm)
void http_header_get(List *headers, long i, Octstr **name, Octstr **value)
void * gwlist_search(List *list, void *pattern, int(*cmp)(void *, void *))
static int date_item_compare(Octstr *before, long time_data, long pos)
static long ota_abort_to_pap(long reason)
static Octstr * extract_base64(struct content *content)
static int read_ppg_config(Cfg *cfg)
void http_header_add(List *headers, char *name, char *contents)
gw_assert(wtls_machine->packet_to_send !=NULL)
void dict_put(Dict *dict, Octstr *key, void *value)
void counter_destroy(Counter *counter)
void gwlist_append(List *list, void *item)
void http_close_client(HTTPClient *client)
static Octstr * set_smsbox_id(List *headers, Octstr *username, int trusted_pi)
static void tell_fatal_error(HTTPClient **c, WAPEvent *e, Octstr *url, int status, int code)
static Counter * push_id_counter
static int pap_get_content(struct content *content)
Octstr * wap_push_ppg_pushuser_smsc_id_get(Octstr *username)
struct tm gw_gmtime(time_t t)
Octstr * wap_push_ppg_pushuser_smsbox_id_get(Octstr *username)
PPGSessionMachine * wap_push_ppg_have_push_session_for(WAPAddrTuple *tuple)
static int transform_message(WAPEvent **e, WAPAddrTuple **tuple, List *push_headers, int connected, Octstr **type)
void gwlist_produce(List *list, void *item)
long gwlist_len(List *list)
static HTTPClient * send_push_response(WAPEvent *e, int status)
static void client(int port)
static Octstr * describe_code(long code)
static int response_push_connection(WAPEvent *e, PPGSessionMachine *sm)
static int push_has_pid(void *a, void *b)
void * gwlist_get(List *list, long pos)
static int content_transformable(List *push_headers)
static struct @42 extractors[]
static void http_read_thread(void *arg)
static void deliver_confirmed_push(long last, PPGPushMachine *pm, PPGSessionMachine *sm)
static long parse_appid_header(Octstr **assigned_code)
static Octstr * convert_sl_to_slc(struct content *content)
static long check_x_wap_application_id_header(List **push_headers)
static void remove_push_data(PPGSessionMachine *sm, PPGPushMachine *pm, int cless)
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
#define cfg_get(grp, varname)
static void request_unit_push(long last, PPGPushMachine *pm)
void http_header_get_content_type(List *headers, Octstr **type, Octstr **charset)
static void request_confirmed_push(long last, PPGPushMachine *pm, PPGSessionMachine *sm)
int wap_push_ppg_pushuser_list_add(List *list, long number_of_pushes, long number_of_users)
static enum @39 run_status
static PPGPushMachine * find_unit_ppg_push_machine_using_pi_push_id(Octstr *pi_push_id)
static void remove_pushless_session(PPGSessionMachine *sm)
static void push_machine_assert(PPGPushMachine *pm)
static PPGPushMachine * update_push_data_with_attribute(PPGSessionMachine **sm, PPGPushMachine *pm, long reason, long status)
void octstr_strip_blanks(Octstr *text)
List * wsp_cap_duplicate_list(List *caps_list)
static Octstr * ppg_dlr_url
static List * ppg_unit_pushes
#define octstr_get_cstr(ostr)
#define octstr_copy(ostr, from, len)
void wap_event_dump(WAPEvent *event)
void gwthread_join_every(gwthread_func_t *func)
int si_compile(Octstr *si_doc, Octstr *charset, Octstr **si_binary)
static int session_has_pi_client_address(void *a, void *b)
unsigned long counter_increase(Counter *counter)
static Octstr * smsbox_id
void http_header_mark_transformation(List *headers, Octstr *new_body, Octstr *new_type)
WAPAddrTuple * wap_addr_tuple_duplicate(WAPAddrTuple *tuple)
static int user_configuration
static void initialize_time_item_array(long time_data[], struct tm now)
static int select_bearer_network(WAPEvent **e)
void http_destroy_headers(List *headers)
static int store_push_data(PPGPushMachine **pm, PPGSessionMachine *sm, WAPEvent *e, WAPAddrTuple *tuple, int cless)
static void remove_mime_headers(List **push_headers)
static PPGSessionMachine * session_find_using_pi_client_address(Octstr *addr)
static Octstr * content_header
static Octstr * tell_ppg_name(void)
void http_destroy_cgiargs(List *args)
static Octstr * ppg_allow_ip
static long number_of_users
static int type_is(Octstr *content_header, char *required_type)
void http_append_headers(List *to, List *from)
void http_send_reply(HTTPClient *client, int status, List *headers, Octstr *body)
static struct @41 converters[]
Octstr * octstr_imm(const char *cstr)
static HTTPClient * response_push_message(PPGPushMachine *pm, long code, int status)
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
static Dict * http_clients
static Octstr * global_sender
void * dict_remove(Dict *dict, Octstr *key)
Counter * counter_create(void)
void cfg_destroy(Cfg *cfg)
static void change_header_value(List **push_headers, char *name, char *value)
static void send_bad_message_response(HTTPClient **c, Octstr *body_fragment, int code, int status)
static Octstr * convert_si_to_sic(struct content *content)
static int pap_convert_content(struct content *content)
void * dict_get(Dict *dict, Octstr *key)
HTTPClient * http_accept_request(int port, Octstr **client_ip, Octstr **url, List **headers, Octstr **body, List **cgivars)
void octstr_delete(Octstr *ostr1, long pos, long len)
void gwlist_remove_producer(List *list)
List * http_create_empty_headers(void)
int wap_push_ppg_pushuser_search_ip_from_wildcarded_list(Octstr *haystack, Octstr *needle, Octstr *gwlist_sep, Octstr *ip_sep)
static PPGSessionMachine * store_session_data(PPGSessionMachine *sm, WAPEvent *e, WAPAddrTuple *tuple, int *session_exists)
void wap_event_destroy_item(void *event)
static wap_dispatch_func_t * dispatch_to_ota
static Octstr * set_service_name(void)
static Octstr * set_time(void)
#define octstr_duplicate(ostr)
long octstr_case_search(const Octstr *haystack, const Octstr *needle, long pos)
List * cfg_get_multi_group(Cfg *cfg, Octstr *name)
static void request_push(long last, PPGPushMachine *sm)
static int ip_allowed_by_ppg(Octstr *ip)
int wap_push_ppg_pushuser_client_phone_number_acceptable(Octstr *username, Octstr *number)
static void pap_event_destroy(PAPEvent *p)
#define http_header_find_first(headers, name)
long gwlist_delete_equal(List *list, void *item)
static WAPAddrTuple * addr_tuple_change_cliport(WAPAddrTuple *tuple, long port)
static Octstr * set_smsc_id(List *headers, Octstr *username, int trusted_pi)
void wap_push_ppg_init(wap_dispatch_func_t *ota_dispatch, wap_dispatch_func_t *appl_dispatch, Cfg *cfg)
int wml_compile(Octstr *wml_text, Octstr *charset, Octstr **wml_binary, Octstr *version)
static PPGPushMachine * push_machine_create(WAPEvent *e, WAPAddrTuple *tuple)
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
#define wap_event_create(type)
static size_t desc_tab_size
static int session_has_sid(void *a, void *b)
void warning(int err, const char *fmt,...)
static PPGPushMachine * abort_delivery(PPGSessionMachine *sm, int status)
void http_remove_hop_headers(List *headers)
void wap_push_ppg_pushuser_list_destroy(void)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
void wap_addr_tuple_destroy(WAPAddrTuple *tuple)
static void pap_event_destroy_item(void *p)
#define gwthread_create(func, arg)
#define octstr_create(cstr)
static int delivery_time_constraints(WAPEvent *e, PPGPushMachine *pm)
static void session_machine_assert(PPGSessionMachine *sm)
static int deliver_before_test_cleared(Octstr *before, struct tm now)
static PPGPushMachine * find_ppg_push_machine_using_pid(PPGSessionMachine *sm, long pid)
Octstr * get_official_name(void)
static long set_dlr_mask(List *headers, Octstr *dlr_url)
int wap_push_ppg_pushuser_authenticate(HTTPClient *c, List *cgivars, Octstr *ip, List *push_headers, Octstr **username)
static void ota_read_thread(void *arg)
static void pap_event_unpack(PAPEvent *p, Octstr **ip, Octstr **url, List **push_headers, Octstr **mime_content, List **cgivars, HTTPClient **client)
void octstr_base64_to_binary(Octstr *ostr)
int http_open_port(int port, int ssl)
static int session_has_addr(void *a, void *b)
static int coriented_deliverable(long code)
static int deliver_after_test_cleared(Octstr *after, struct tm now)
void http_close_all_ports(void)
static long number_of_pushes
Octstr * http_header_value(List *headers, Octstr *name)
long octstr_len(const Octstr *ostr)
void dict_destroy(Dict *dict)
long gwlist_delete_matching(List *list, void *pat, gwlist_item_matches_t *matches)
static PPGPushMachine * deliver_unit_push(long last, PPGPushMachine *pm, PPGSessionMachine *sm, int session_exists)
static void pap_request_thread(void *arg)
int cfg_get_bool(int *n, CfgGroup *grp, Octstr *varname)
static PAPEvent * pap_event_create(Octstr *ip, Octstr *url, List *push_headers, Octstr *mime_content, List *cgivars, HTTPClient *client)
void * gwlist_consume(List *list)
static Octstr * convert_wml_to_wmlc(struct content *content)
#define NUMBER_OF_WINA_URIS
static void deliver_pending_pushes(PPGSessionMachine *sm, int last)
void debug(const char *place, int err, const char *fmt,...)
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
static description_t pap_desc[]
static Octstr * ppg_smsbox_id
static void remove_session_data(PPGSessionMachine *sm, int status)
void wap_push_ppg_shutdown(void)
static void send_to_pi(HTTPClient **c, Octstr *reply_body, int status)
static int push_has_pi_push_id(void *a, void *b)
static void remove_link_headers(List **push_headers)
long http_header_remove_all(List *headers, char *name)
WAPAddrTuple * wap_addr_tuple_create(Octstr *rmt_addr, long rmt_port, Octstr *lcl_addr, long lcl_port)
long octstr_parse_long(long *nump, Octstr *ostr, long pos, int base)
void wap_push_ppg_dispatch_event(WAPEvent *e)
static WAPAddrTuple * set_addr_tuple(Octstr *address, long cliport, long servport, long address_type, List *push_headers)
static void push_machine_destroy(void *pm)
void octstr_format_append(Octstr *os, const char *fmt,...)
List * http_header_duplicate(List *headers)
static void replace_octstr_char(Octstr *os1, Octstr *os2, long *pos)
static void create_session(WAPEvent *e, PPGPushMachine *pm)
static wap_dispatch_func_t * dispatch_to_appl
int dict_put_once(Dict *dict, Octstr *key, void *value)
static Octstr * ppg_deny_ip
static Octstr * set_dlr_url(List *headers, Octstr *username, int trusted_pi)
static void session_machine_destroy(void *p)
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
void gwlist_add_producer(List *list)
static int get_mime_boundary(List *push_headers, Octstr *content_header, Octstr **boundary)
static PPGSessionMachine * update_session_data(PPGSessionMachine *sm, long sid, long port, List *caps)
int octstr_get_char(const Octstr *ostr, long pos)
#define NUMBER_OF_BEARERS
#define NUMBER_OF_NETWORKS
static char * address_type(long type_of_address)
int mime_parse(Octstr *boundary, Octstr *mime_content, Octstr **pap_content, Octstr **push_data, List **content_headers, Octstr **rdf_content)
static PPGSessionMachine * session_machine_create(WAPAddrTuple *tuple, WAPEvent *e)
int pap_compile(Octstr *pap_content, WAPEvent **e)
static PPGPushMachine * find_ppg_push_machine_using_pi_push_id(PPGSessionMachine *sm, Octstr *pi_push_id)
static int handle_push_message(HTTPClient **c, WAPEvent *ppg_event, int status)
static List * ppg_machines
void wap_event_destroy(WAPEvent *event)
static PPGSessionMachine * update_session_data_with_headers(PPGSessionMachine *sm, PPGPushMachine *pm)
void wap_dispatch_func_t(WAPEvent *event)
static void push_machines_list_destroy(List *pl)
PPGSessionMachine * wap_push_ppg_have_push_session_for_sid(long sid)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
static void handle_internal_event(WAPEvent *e)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)