diff options
author | dimitri staessens <[email protected]> | 2016-03-24 19:52:01 +0100 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-03-24 19:52:01 +0100 |
commit | 545092a8eaa1a972a2bcaf1b532d74f21db1b623 (patch) | |
tree | becb621b18a37626728378576ffae4dd58b5290a /include | |
parent | dd30bcdb1d440d812b47c0b998c8f120b271ea9b (diff) | |
parent | c32ccc39cfc793729890204c8d810eb7608f4474 (diff) | |
download | ouroboros-545092a8eaa1a972a2bcaf1b532d74f21db1b623.tar.gz ouroboros-545092a8eaa1a972a2bcaf1b532d74f21db1b623.zip |
Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be-shm
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/da.h | 6 | ||||
-rw-r--r-- | include/ouroboros/dev.h | 12 | ||||
-rw-r--r-- | include/ouroboros/ipcp.h | 2 | ||||
-rw-r--r-- | include/ouroboros/logs.h | 28 | ||||
-rw-r--r-- | include/ouroboros/rina_name.h | 14 | ||||
-rw-r--r-- | include/ouroboros/sockets.h | 31 |
6 files changed, 60 insertions, 33 deletions
diff --git a/include/ouroboros/da.h b/include/ouroboros/da.h index 2a046f6b..f678007d 100644 --- a/include/ouroboros/da.h +++ b/include/ouroboros/da.h @@ -26,12 +26,12 @@ #include "common.h" #include "rina_name.h" -rina_name_t * da_resolve_daf(char * daf_name); +char * da_resolve_daf(char * daf_name); /* * n_1_difs is an out parameter * The amount of n_1_difs is returned */ -ssize_t da_resolve_dap(rina_name_t * name, - char ** n_1_difs); +ssize_t da_resolve_dap(char * name, + char ** n_1_difs); #endif diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index 39194abd..b2507fbf 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -26,19 +26,17 @@ #include <ouroboros/common.h> /* Returns file descriptor */ -int ap_reg(char * ap_name, char * ae_name, - char ** difs, size_t difs_size); -int ap_unreg(char * ap_name, char * ae_name, - char ** difs, size_t difs_size); +int ap_reg(char * ap_name, char ** difs, size_t difs_size); +int ap_unreg(char * ap_name, char ** difs, size_t difs_size); /* Returns file descriptor (> 0) and client name(s) */ int flow_accept(int fd, char * ap_name, char * ae_name); int flow_alloc_resp(int fd, int result); /* Returns file descriptor */ -int flow_alloc(char * dst_ap_name, char * dst_ae_name, - char * src_ap_name, char * src_ae_name, - struct qos_spec * qos, int oflags); +int flow_alloc(char * dst_ap_name, char * src_ap_name, + char * src_ae_name, struct qos_spec * qos, + int oflags); /* If flow is accepted returns a value > 0 */ int flow_alloc_res(int fd); diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index 5e3e7f8c..b8775fc0 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -46,7 +46,7 @@ int ipcp_bootstrap(pid_t pid, struct dif_config conf); int ipcp_enroll(pid_t pid, char * dif_name, - rina_name_t member, + char * member_name, char ** n_1_difs, ssize_t n_1_difs_size); diff --git a/include/ouroboros/logs.h b/include/ouroboros/logs.h index 6f9986dc..344a7ddc 100644 --- a/include/ouroboros/logs.h +++ b/include/ouroboros/logs.h @@ -30,21 +30,33 @@ #error You must define OUROBOROS_PREFIX before including this file #endif -#define __LOG(PFX, LVL, FMT, ARGS...) \ - do { printf(PFX "(" LVL "): " FMT "\n", ##ARGS); } while (0) - -#define LOG_ERR(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "ERR", FMT, ##ARGS) -#define LOG_WARN(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "WARN", FMT, ##ARGS) -#define LOG_INFO(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "INFO", FMT, ##ARGS) +#define ANSI_COLOR_RED "\x1b[31m" +#define ANSI_COLOR_GREEN "\x1b[32m" +#define ANSI_COLOR_YELLOW "\x1b[33m" +#define ANSI_COLOR_BLUE "\x1b[34m" +#define ANSI_COLOR_RESET "\x1b[0m" + +#define __LOG(CLR, PFX, LVL, FMT, ARGS...) \ + do { printf(CLR PFX "(" LVL "): " FMT ANSI_COLOR_RESET "\n", ##ARGS); }\ + while (0) + +#define LOG_ERR(FMT, ARGS...) __LOG(ANSI_COLOR_RED, OUROBOROS_PREFIX, \ + "EE", FMT, ##ARGS) +#define LOG_WARN(FMT, ARGS...) __LOG(ANSI_COLOR_YELLOW, OUROBOROS_PREFIX, \ + "WW", FMT, ##ARGS) +#define LOG_INFO(FMT, ARGS...) __LOG(ANSI_COLOR_GREEN, OUROBOROS_PREFIX, \ + "II", FMT, ##ARGS) +#define LOG_NI(FMT, ARGS...) __LOG(ANSI_COLOR_BLUE, OUROBOROS_PREFIX, \ + "NI", FMT, ##ARGS) #ifdef CONFIG_OUROBOROS_DEBUG -#define LOG_DBG(FMT, ARGS...) __LOG(OUROBOROS_PREFIX, "DBG", FMT, ##ARGS) +#define LOG_DBG(FMT, ARGS...) __LOG("", OUROBOROS_PREFIX, "DB", FMT, ##ARGS) #else #define LOG_DBG(FMT, ARGS...) do { } while (0) #endif #define LOG_DBGF(FMT, ARGS...) LOG_DBG("%s: " FMT, __FUNCTION__, ##ARGS) -#define LOG_MISSING LOG_ERR("Missing code in %s:%d",__FILE__, __LINE__) +#define LOG_MISSING LOG_NI("Missing code in %s:%d",__FILE__, __LINE__) #endif diff --git a/include/ouroboros/rina_name.h b/include/ouroboros/rina_name.h index d802ae14..f8af00c2 100644 --- a/include/ouroboros/rina_name.h +++ b/include/ouroboros/rina_name.h @@ -27,8 +27,6 @@ typedef struct { char * ap_name; unsigned int api_id; - char * ae_name; - unsigned int aei_id; } rina_name_t; /* @@ -50,16 +48,12 @@ rina_name_t * name_create(); */ rina_name_t * name_init_from(rina_name_t * dst, const char * ap_name, - unsigned int api_id, - const char * ae_name, - unsigned int aei_id); + unsigned int api_id); /* Takes ownership of the passed parameters */ rina_name_t * name_init_with(rina_name_t * dst, char * ap_name, - unsigned int api_id, - char * ae_name, - unsigned int aei_id); + unsigned int api_id); /* * Finalize a name object, releasing all the embedded resources (without @@ -85,9 +79,7 @@ bool name_is_ok(const rina_name_t * n); #define NAME_CMP_APN 0x01 #define NAME_CMP_API 0x02 -#define NAME_CMP_AEN 0x04 -#define NAME_CMP_AEI 0x08 -#define NAME_CMP_ALL (NAME_CMP_APN | NAME_CMP_API | NAME_CMP_AEN | NAME_CMP_AEI) +#define NAME_CMP_ALL (NAME_CMP_APN | NAME_CMP_API) bool name_cmp(uint8_t flags, const rina_name_t * a, diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h index 426e1006..45d7a27d 100644 --- a/include/ouroboros/sockets.h +++ b/include/ouroboros/sockets.h @@ -40,7 +40,21 @@ enum irm_msg_code { IRM_BOOTSTRAP_IPCP, IRM_ENROLL_IPCP, IRM_REG_IPCP, - IRM_UNREG_IPCP + IRM_UNREG_IPCP, + IRM_AP_REG, + IRM_AP_REG_R, + IRM_AP_UNREG, + IRM_FLOW_ACCEPT, + IRM_FLOW_ACCEPT_R, + IRM_FLOW_ALLOC_RESP, + IRM_FLOW_ALLOC, + IRM_FLOW_ALLOC_R, + IRM_FLOW_ALLOC_RES, + IRM_FLOW_ALLOC_RES_R, + IRM_FLOW_DEALLOC, + IRM_FLOW_CONTROL, + IRM_FLOW_WRITE, + IRM_FLOW_READ }; struct irm_msg { @@ -51,6 +65,14 @@ struct irm_msg { char * dif_name; char ** difs; size_t difs_size; + char * ap_name; + char * ae_name; + int fd; + int result; + struct qos_spec * qos; + int oflags; + char * dst_ap_name; + ssize_t count; }; enum ipcp_msg_code { @@ -64,7 +86,7 @@ struct ipcp_msg { enum ipcp_msg_code code; struct dif_config * conf; char * dif_name; - rina_name_t * member; + char * ap_name; char ** difs; size_t difs_size; }; @@ -72,8 +94,11 @@ struct ipcp_msg { /* Returns the full socket path of an IPCP */ char * ipcp_sock_path(pid_t pid); -int client_socket_open(char * file_name); int server_socket_open(char * file_name); +int client_socket_open(char * file_name); + +int send_irmd_msg(struct irm_msg * msg); +struct irm_msg * send_recv_irmd_msg(struct irm_msg * msg); /* Caller has to free the buffer */ buffer_t * serialize_irm_msg(struct irm_msg * msg); |