diff options
author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-04-13 12:09:14 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-04-13 12:14:24 +0200 |
commit | 21187cdf04f6b6697064430aac68dcf795923943 (patch) | |
tree | fb86f87679dda03cc53e06d9b0c6d3ee0ef26751 /include | |
parent | b43e8cd0f0858e78486752007c3640b70bf44c8d (diff) | |
download | ouroboros-21187cdf04f6b6697064430aac68dcf795923943.tar.gz ouroboros-21187cdf04f6b6697064430aac68dcf795923943.zip |
include: Add C++ directives in headers
Fixes #34
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/ouroboros/cacep.h | 6 | ||||
-rw-r--r-- | include/ouroboros/cdap.h | 6 | ||||
-rw-r--r-- | include/ouroboros/cdefs.h | 35 | ||||
-rw-r--r-- | include/ouroboros/dev.h | 9 | ||||
-rw-r--r-- | include/ouroboros/fcntl.h | 6 | ||||
-rw-r--r-- | include/ouroboros/fqueue.h | 6 | ||||
-rw-r--r-- | include/ouroboros/irm.h | 5 | ||||
-rw-r--r-- | include/ouroboros/nsm.h | 7 |
9 files changed, 79 insertions, 2 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt index 748d5e2d..b07568e3 100644 --- a/include/ouroboros/CMakeLists.txt +++ b/include/ouroboros/CMakeLists.txt @@ -5,6 +5,7 @@ configure_file( set(HEADER_FILES cacep.h cdap.h + cdefs.h dev.h errno.h fcntl.h diff --git a/include/ouroboros/cacep.h b/include/ouroboros/cacep.h index 950f3cf7..967151de 100644 --- a/include/ouroboros/cacep.h +++ b/include/ouroboros/cacep.h @@ -24,6 +24,8 @@ #ifndef OUROBOROS_CACEP_H #define OUROBOROS_CACEP_H +#include <ouroboros/cdefs.h> + #include <stdint.h> enum proto_concrete_syntax { @@ -40,10 +42,14 @@ struct conn_info { uint64_t addr; }; +__BEGIN_DECLS + int cacep_snd(int fd, const struct conn_info * in); int cacep_rcv(int fd, struct conn_info * out); +__END_DECLS + #endif /* OUROBOROS_CACEP_H */ diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h index 32edb51c..fe16a9c9 100644 --- a/include/ouroboros/cdap.h +++ b/include/ouroboros/cdap.h @@ -24,6 +24,8 @@ #ifndef OUROBOROS_CDAP_H #define OUROBOROS_CDAP_H +#include <ouroboros/cdefs.h> + #include <stdbool.h> #include <stdint.h> #include <unistd.h> @@ -46,6 +48,8 @@ struct cdap; typedef int32_t cdap_key_t; +__BEGIN_DECLS + struct cdap * cdap_create(void); int cdap_destroy(struct cdap * instance); @@ -81,4 +85,6 @@ int cdap_reply_send(struct cdap * instance, const void * data, size_t len); +__END_DECLS + #endif /* OUROBOROS_CDAP_H */ diff --git a/include/ouroboros/cdefs.h b/include/ouroboros/cdefs.h new file mode 100644 index 00000000..da7c4732 --- /dev/null +++ b/include/ouroboros/cdefs.h @@ -0,0 +1,35 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * C Definitions + * + * Dimitri Staessens <dimitri.staessens@ugent.be> + * Sander Vrijders <sander.vrijders@ugent.be> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef OUROBOROS_CDEFS_H +#define OUROBOROS_CDEFS_H + +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + +#endif /* OUROBOROS_CDEFS_H */ diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h index 396f2ae3..73d2d7b6 100644 --- a/include/ouroboros/dev.h +++ b/include/ouroboros/dev.h @@ -21,13 +21,16 @@ * 02110-1301 USA */ +#ifndef OUROBOROS_DEV_H +#define OUROBOROS_DEV_H + +#include <ouroboros/cdefs.h> #include <ouroboros/qos.h> #include <unistd.h> #include <time.h> -#ifndef OUROBOROS_DEV_H -#define OUROBOROS_DEV_H +__BEGIN_DECLS /* These calls should be removed once we write the ouroboros OS. */ int ouroboros_init(const char * ap_name); @@ -53,4 +56,6 @@ ssize_t flow_read(int fd, void * buf, size_t count); +__END_DECLS + #endif /* OUROBOROS_DEV_H */ diff --git a/include/ouroboros/fcntl.h b/include/ouroboros/fcntl.h index 65e8c378..489fff15 100644 --- a/include/ouroboros/fcntl.h +++ b/include/ouroboros/fcntl.h @@ -24,6 +24,8 @@ #ifndef OUROBOROS_FCNTL_H #define OUROBOROS_FCNTL_H +#include <ouroboros/cdefs.h> + #include <sys/time.h> /* same values as fcntl.h */ @@ -37,6 +39,8 @@ #define FLOW_O_INVALID (FLOW_O_WRONLY | FLOW_O_RDWR) +__BEGIN_DECLS + int flow_set_flags(int fd, int flags); @@ -51,4 +55,6 @@ int flow_get_timeout(int fd, int flow_get_qosspec(int fd, qosspec_t * qs); +__END_DECLS + #endif /* OUROBOROS_FCNTL_H */ diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h index fc7dc303..604fabf7 100644 --- a/include/ouroboros/fqueue.h +++ b/include/ouroboros/fqueue.h @@ -24,6 +24,8 @@ #ifndef OUROBOROS_FQUEUE_H #define OUROBOROS_FQUEUE_H +#include <ouroboros/cdefs.h> + #include <stdbool.h> #include <time.h> @@ -34,6 +36,8 @@ struct fqueue; typedef struct flow_set flow_set_t; typedef struct fqueue fqueue_t; +__BEGIN_DECLS + flow_set_t * flow_set_create(void); void flow_set_destroy(flow_set_t * set); @@ -59,4 +63,6 @@ int flow_event_wait(flow_set_t * set, fqueue_t * fq, const struct timespec * timeout); +__END_DECLS + #endif /* OUROBOROS_FQUEUE_H */ diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h index d1aa5230..61b2fd87 100644 --- a/include/ouroboros/irm.h +++ b/include/ouroboros/irm.h @@ -24,6 +24,7 @@ #ifndef OUROBOROS_IRM_H #define OUROBOROS_IRM_H +#include <ouroboros/cdefs.h> #include <ouroboros/ipcp.h> #include <sys/types.h> @@ -33,6 +34,8 @@ #define BIND_AP_AUTO 0x01 #define BIND_AP_UNIQUE 0x02 +__BEGIN_DECLS + pid_t irm_create_ipcp(const char * name, enum ipcp_type ipcp_type); @@ -71,4 +74,6 @@ int irm_unreg(const char * name, char ** difs, size_t len); +__END_DECLS + #endif /* OUROBOROS_IRM_H */ diff --git a/include/ouroboros/nsm.h b/include/ouroboros/nsm.h index 22a2a593..45adfed3 100644 --- a/include/ouroboros/nsm.h +++ b/include/ouroboros/nsm.h @@ -24,9 +24,13 @@ #ifndef OUROBOROS_NSM_H #define OUROBOROS_NSM_H +#include <ouroboros/cdefs.h> + #include <stdint.h> #include <unistd.h> +__BEGIN_DECLS + int nsm_reg(char * name, char ** dafs, size_t dafs_size); @@ -41,4 +45,7 @@ int nsm_unreg(char * name, */ ssize_t nsm_resolve(char * name, char ** dafs); + +__END_DECLS + #endif |