summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/dev.h16
-rw-r--r--include/ouroboros/fcntl.h4
-rw-r--r--include/ouroboros/fqueue.h4
-rw-r--r--include/ouroboros/ipcp-dev.h3
-rw-r--r--include/ouroboros/irm.h48
-rw-r--r--include/ouroboros/shm_rdrbuff.h4
-rw-r--r--include/ouroboros/utils.h10
7 files changed, 50 insertions, 39 deletions
diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h
index 8ac38124..1d2a2533 100644
--- a/include/ouroboros/dev.h
+++ b/include/ouroboros/dev.h
@@ -30,7 +30,7 @@
#define UNKNOWN_AE "__UNKNOWN_AE__"
/* These calls should be removed once we write the ouroboros OS. */
-int ap_init(char * ap_name);
+int ap_init(const char * ap_name);
void ap_fini(void);
@@ -43,19 +43,19 @@ int flow_alloc_resp(int fd,
/*
* Returns flow descriptor (> 0).
- * On returning, qos will contain the actual supplied QoS.
+ * On returning, spec will contain the actual supplied QoS.
*/
-int flow_alloc(char * dst_name,
- char * src_ae_name,
- qosspec_t * spec);
+int flow_alloc(const char * dst_name,
+ const char * src_ae_name,
+ qosspec_t * spec);
int flow_alloc_res(int fd);
int flow_dealloc(int fd);
-ssize_t flow_write(int fd,
- void * buf,
- size_t count);
+ssize_t flow_write(int fd,
+ const void * buf,
+ size_t count);
ssize_t flow_read(int fd,
void * buf,
diff --git a/include/ouroboros/fcntl.h b/include/ouroboros/fcntl.h
index ad968a1d..7ee4229e 100644
--- a/include/ouroboros/fcntl.h
+++ b/include/ouroboros/fcntl.h
@@ -41,8 +41,8 @@ int flow_set_flags(int fd,
int flow_get_flags(int fd);
-int flow_set_timeout(int fd,
- struct timespec * to);
+int flow_set_timeout(int fd,
+ const struct timespec * to);
int flow_get_timeout(int fd,
struct timespec * to);
diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h
index 254648e6..fdd2cbfb 100644
--- a/include/ouroboros/fqueue.h
+++ b/include/ouroboros/fqueue.h
@@ -47,8 +47,8 @@ void flow_set_zero(flow_set_t * set);
int flow_set_add(flow_set_t * set,
int fd);
-bool flow_set_has(flow_set_t * set,
- int fd);
+bool flow_set_has(const flow_set_t * set,
+ int fd);
void flow_set_del(flow_set_t * set,
int fd);
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
index d4e174fb..81aca1d7 100644
--- a/include/ouroboros/ipcp-dev.h
+++ b/include/ouroboros/ipcp-dev.h
@@ -26,7 +26,8 @@
#ifndef OUROBOROS_IPCP_DEV_H
#define OUROBOROS_IPCP_DEV_H
-int ipcp_create_r(pid_t api);
+int ipcp_create_r(pid_t api,
+ int result);
int ipcp_flow_req_arr(pid_t api,
char * dst_name,
diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h
index 79e3e7c9..07052727 100644
--- a/include/ouroboros/irm.h
+++ b/include/ouroboros/irm.h
@@ -26,42 +26,42 @@
#include <ouroboros/irm_config.h>
#include <sys/types.h>
-pid_t irm_create_ipcp(char * name,
+pid_t irm_create_ipcp(const char * name,
enum ipcp_type ipcp_type);
int irm_destroy_ipcp(pid_t api);
/* apis is an out-parameter */
-ssize_t irm_list_ipcps(char * name,
- pid_t ** apis);
+ssize_t irm_list_ipcps(const char * name,
+ pid_t ** apis);
-int irm_enroll_ipcp(pid_t api,
- char * dif_name);
+int irm_enroll_ipcp(pid_t api,
+ const char * dif_name);
-int irm_bootstrap_ipcp(pid_t api,
- struct dif_config * conf);
+int irm_bootstrap_ipcp(pid_t api,
+ const struct dif_config * conf);
-int irm_bind_ap(char * ap,
- char * name,
- uint16_t opts,
- int argc,
- char ** argv);
+int irm_bind_ap(const char * ap,
+ const char * name,
+ uint16_t opts,
+ int argc,
+ char ** argv);
-int irm_unbind_ap(char * ap,
- char * name);
+int irm_unbind_ap(const char * ap,
+ const char * name);
-int irm_bind_api(pid_t api,
- char * name);
+int irm_bind_api(pid_t api,
+ const char * name);
-int irm_unbind_api(pid_t api,
- char * name);
+int irm_unbind_api(pid_t api,
+ const char * name);
-int irm_reg(char * name,
- char ** difs,
- size_t difs_size);
+int irm_reg(const char * name,
+ char ** difs,
+ size_t len);
-int irm_unreg(char * name,
- char ** difs,
- size_t difs_size);
+int irm_unreg(const char * name,
+ char ** difs,
+ size_t len);
#endif /* OUROBOROS_IRM_H */
diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h
index 2e23381b..73d6bfbc 100644
--- a/include/ouroboros/shm_rdrbuff.h
+++ b/include/ouroboros/shm_rdrbuff.h
@@ -49,13 +49,13 @@ void shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb);
ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
size_t headspace,
size_t tailspace,
- uint8_t * data,
+ const uint8_t * data,
size_t data_len);
ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
size_t headspace,
size_t tailspace,
- uint8_t * data,
+ const uint8_t * data,
size_t data_len);
ssize_t shm_rdrbuff_read(uint8_t ** dst,
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h
index 52873a7e..29fb4367 100644
--- a/include/ouroboros/utils.h
+++ b/include/ouroboros/utils.h
@@ -46,4 +46,14 @@ char * strdup(const char * src);
/* gets the application name */
char * path_strip(char * src);
+/* destroy a ** */
+#define freepp(type, ptr, len) \
+ do { \
+ if (len == 0) \
+ break; \
+ while (len > 0) \
+ free(((type **) ptr)[--len]); \
+ free(ptr); \
+ } while (0);
+
#endif /* OUROBOROS_UTILS_H */