X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Finclude%2Fnotification.h;fp=src%2Finclude%2Fnotification.h;h=79161901bf6f5e6ca163e664e9fee214ab934a9b;hb=633d206d652087e0b170535a6e7fd0b33c8dc816;hp=0000000000000000000000000000000000000000;hpb=f9280086a261a27b286001ea0fd419de750a57c2;p=cilux diff --git a/src/include/notification.h b/src/include/notification.h new file mode 100644 index 0000000..7916190 --- /dev/null +++ b/src/include/notification.h @@ -0,0 +1,93 @@ + +#ifndef ni_H +#define ni_H + +/* -------------------------------------------------------------------------- */ + +typedef struct n_object{ + k_hashtable* headers; + k_hashtable* content; +} n_object; + +PUBLIC n_object* n_object_new(char* s); +PUBLIC void n_commit(n_object* o); +PUBLIC n_object* n_see(n_object* o, char* uid); +PUBLIC char* n_to_string(n_object* o); +PUBLIC char* n_uid(n_object* o); +PUBLIC char* n_header(n_object* o, char* name); +PUBLIC k_hashtable* n_headers(n_object* o); +PUBLIC k_hashtable* n_content(n_object* o); + +/* -------------------------------------------------------------------------- */ + +PUBLIC char* ni_hostname(void); +PUBLIC void ni_hostname_set(char* name); + +/* -------------------------------------------------------------------------- */ + +typedef struct ni_resource{ + char* uri; + k_hashtable* ent_head; + void* entity; +} ni_resource; + +PUBLIC ni_resource* ni_resource_new(char* uri, + k_hashtable* ent_head, + char* entity); +PUBLIC ni_resource* ni_resource_dup( ni_resource* res); +PUBLIC void ni_resource_delete(ni_resource* res); +PUBLIC void ni_resource_show( ni_resource* res, char* text); +PUBLIC ni_resource* ni_resource_get(char* uri); + +/* -------------------------------------------------------------------------- */ + +typedef struct ni_event{ + char* uri; + k_hashtable* evt_head; + k_hashtable* ent_head; + void* entity; +} ni_event; + +PUBLIC ni_event* ni_event_new(char* uri, + k_hashtable* evt_head, + k_hashtable* ent_head, + char* entity); +PUBLIC ni_event* ni_event_dup( ni_event* res); +PUBLIC void ni_event_delete(ni_event* res); +PUBLIC void ni_event_show( ni_event* res, char* text); + +/* -------------------------------------------------------------------------- */ + +PUBLIC ni_event* ni_res_to_evt(ni_resource* res); + +/* -------------------------------------------------------------------------- */ + +typedef int (*ni_handles_resource)(char*); +typedef void (*ni_sync_resource )(ni_resource*); + +PUBLIC void ni_register_driver(char* name, + ni_handles_resource handles_resource, + ni_sync_resource sync_resource); + +/* -------------------------------------------------------------------------- */ + +PUBLIC ni_event* ni_get_request_headers( char* header); +PUBLIC ni_event* ni_get_response_headers(char* header); +PUBLIC char* ni_get_headers( char* header, k_hashtable*, k_hashtable*); +PUBLIC void ni_fix_http_headers(k_hashtable* ent_head); +PUBLIC void ni_fix_ni_headers(k_hashtable* ent_head, int methead); +PUBLIC void ni_response(ni_event* evt, + char* to, + char* method, + char* protocol, + char* connection, + k_channel* chan); +PUBLIC void ni_request(ni_event* evt, + char* to, + char* method, + k_channel* chan); + +/* -------------------------------------------------------------------------- */ + +#endif +