5 /* -------------------------------------------------------------------------- */
7 typedef struct n_object{
12 typedef struct n_event {
17 typedef int (*n_handles_object)(char*);
18 typedef void (*n_view_event)(n_object*, n_object*);
19 typedef void (*n_cast_event)(n_object*, n_object*);
20 typedef void (*n_sync_object)(n_object*);
22 PUBLIC void n_register_driver(char* name,
23 n_handles_object handles_object,
24 n_view_event view_event,
25 n_cast_event cast_event,
26 n_sync_object sync_object );
28 PUBLIC n_object* n_object_new(char* s);
29 PUBLIC void n_commit(n_object* o);
30 PUBLIC n_object* n_view(n_object* o, char* uid);
31 PUBLIC char* n_to_string(n_object* o);
32 PUBLIC char* n_uid(n_object* o);
33 PUBLIC int n_uid_is(n_object* o, char* uid);
34 PUBLIC char* n_header(n_object* o, char* name);
35 PUBLIC k_hashtable* n_headers(n_object* o);
36 PUBLIC k_hashtable* n_content(n_object* o);
37 PUBLIC void n_dispatch(n_event*);
39 /* -------------------------------------------------------------------------- */
41 PUBLIC char* ni_hostname(void);
42 PUBLIC void ni_hostname_set(char* name);
44 /* -------------------------------------------------------------------------- */
46 typedef struct ni_resource{
48 k_hashtable* ent_head;
52 PUBLIC ni_resource* ni_resource_new(char* uri,
53 k_hashtable* ent_head,
55 PUBLIC ni_resource* ni_resource_dup( ni_resource* res);
56 PUBLIC void ni_resource_delete(ni_resource* res);
57 PUBLIC void ni_resource_show( ni_resource* res, char* text);
58 PUBLIC ni_resource* ni_resource_get(char* uri);
60 /* -------------------------------------------------------------------------- */
62 typedef struct ni_event{
64 k_hashtable* evt_head;
65 k_hashtable* ent_head;
69 PUBLIC ni_event* ni_event_new(char* uri,
70 k_hashtable* evt_head,
71 k_hashtable* ent_head,
73 PUBLIC ni_event* ni_event_dup( ni_event* res);
74 PUBLIC void ni_event_delete(ni_event* res);
75 PUBLIC void ni_event_show( ni_event* res, char* text);
77 /* -------------------------------------------------------------------------- */
79 PUBLIC ni_event* ni_res_to_evt(ni_resource* res);
81 /* -------------------------------------------------------------------------- */
83 typedef int (*ni_handles_resource)(char*);
84 typedef void (*ni_sync_resource )(ni_resource*);
86 PUBLIC void ni_register_driver(char* name,
87 ni_handles_resource handles_resource,
88 ni_sync_resource sync_resource);
90 /* -------------------------------------------------------------------------- */
92 PUBLIC ni_event* ni_get_request_headers( char* header);
93 PUBLIC ni_event* ni_get_response_headers(char* header);
94 PUBLIC char* ni_get_headers( char* header, k_hashtable*, k_hashtable*);
95 PUBLIC void ni_fix_http_headers(k_hashtable* ent_head);
96 PUBLIC void ni_fix_ni_headers(k_hashtable* ent_head, int methead);
97 PUBLIC void ni_response(ni_event* evt,
103 PUBLIC void ni_request(ni_event* evt,
108 /* -------------------------------------------------------------------------- */