first import of old cilux linux platform code
[cilux] / src / include / ni.h
diff --git a/src/include/ni.h b/src/include/ni.h
new file mode 100644 (file)
index 0000000..32c90b2
--- /dev/null
@@ -0,0 +1,77 @@
+
+#ifndef ni_H
+#define ni_H
+
+/* -------------------------------------------------------------------------- */
+
+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);
+EXPORT void      ni_request(ni_event* evt,
+                            char*      to,
+                            char*      method,
+                            k_channel* chan);
+
+/* -------------------------------------------------------------------------- */
+
+#endif
+