summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.h
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-08-24 18:48:17 +0200
committerSander Vrijders <[email protected]>2016-08-24 18:48:17 +0200
commit103325209373f0aec818efd775f91243eb912a33 (patch)
treedfed42eeaea49ec839f867d89dda6a2cc69b560a /src/ipcpd/ipcp.h
parentf32db895e62152e1518fc5e184d19743d35e6cad (diff)
parent9c0c55198c2406fea6be189e1ec6b3ac3cc565fc (diff)
downloadouroboros-103325209373f0aec818efd775f91243eb912a33.tar.gz
ouroboros-103325209373f0aec818efd775f91243eb912a33.zip
Merged in dstaesse/ouroboros/be-ipcp-locks (pull request #221)
ipcpd: Revised locking
Diffstat (limited to 'src/ipcpd/ipcp.h')
-rw-r--r--src/ipcpd/ipcp.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h
index 8b7d4ec9..edaea0fd 100644
--- a/src/ipcpd/ipcp.h
+++ b/src/ipcpd/ipcp.h
@@ -27,12 +27,14 @@
#include <ouroboros/shared.h>
#include <pthread.h>
+#include <time.h>
#include "ipcp-ops.h"
#include "ipcp-data.h"
enum ipcp_state {
- IPCP_INIT = 0,
+ IPCP_NULL = 0,
+ IPCP_INIT,
IPCP_PENDING_ENROLL,
IPCP_ENROLLED,
IPCP_DISCONNECTED,
@@ -45,15 +47,27 @@ struct ipcp {
int irmd_fd;
enum ipcp_state state;
- pthread_mutex_t state_lock;
+ pthread_rwlock_t state_lock;
+ pthread_mutex_t state_mtx;
pthread_cond_t state_cond;
};
-struct ipcp * ipcp_instance_create();
-void ipcp_state_change(struct ipcp * ipcp,
- enum ipcp_state state);
-void * ipcp_main_loop(void * o);
-void * ipcp_sdu_loop(void * o);
-int ipcp_parse_arg(int argc, char * argv[]);
+struct ipcp * ipcp_instance_create();
+
+void ipcp_set_state(struct ipcp * ipcp,
+ enum ipcp_state state);
+
+enum ipcp_state ipcp_get_state(struct ipcp * ipcp);
+
+int ipcp_wait_state(struct ipcp * ipcp,
+ enum ipcp_state state,
+ const struct timespec * timeout);
+
+void * ipcp_main_loop(void * o);
+
+void * ipcp_sdu_loop(void * o);
+
+int ipcp_parse_arg(int argc,
+ char * argv[]);
#endif