summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dev.c37
-rw-r--r--src/lib/irmd_messages.proto48
2 files changed, 61 insertions, 24 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index cc332233..765c493e 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -134,6 +134,42 @@ void ap_fini(void)
free(_ap_instance);
}
+int api_bind(char * ap_subset)
+{
+ irm_msg_t msg = IRM_MSG__INIT;
+ irm_msg_t * recv_msg = NULL;
+ int ret = -1;
+
+ msg.code = IRM_MSG_CODE__IRM_API_BIND;
+ msg.has_api = true;
+
+ if (_ap_instance->ap_name == NULL)
+ return -EPERM; /* call init first */
+
+ pthread_rwlock_rdlock(&_ap_instance->data_lock);
+
+ msg.api = _ap_instance->api;
+ msg.ap_name = _ap_instance->ap_name;
+
+ pthread_rwlock_unlock(&_ap_instance->data_lock);
+
+ msg.ap_subset = ap_subset;
+
+ recv_msg = send_recv_irm_msg(&msg);
+ if (recv_msg == NULL) {
+ return -1;
+ }
+
+ if (!recv_msg->has_result || (ret = recv_msg->result)) {
+ irm_msg__free_unpacked(recv_msg, NULL);
+ return ret;
+ }
+
+ irm_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
+
static int port_id_to_fd(int port_id)
{
int i;
@@ -154,7 +190,6 @@ int flow_accept(char ** ae_name)
pthread_rwlock_rdlock(&_ap_instance->data_lock);
- msg.ap_name = _ap_instance->ap_name;
msg.api = _ap_instance->api;
pthread_rwlock_unlock(&_ap_instance->data_lock);
diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto
index 730f842c..5c320a17 100644
--- a/src/lib/irmd_messages.proto
+++ b/src/lib/irmd_messages.proto
@@ -31,32 +31,34 @@ enum irm_msg_code {
IRM_ENROLL_IPCP = 6;
IRM_BIND = 7;
IRM_UNBIND = 8;
- IRM_REG = 9;
- IRM_UNREG = 10;
- IRM_FLOW_ACCEPT = 11;
- IRM_FLOW_ALLOC_RESP = 12;
- IRM_FLOW_ALLOC = 13;
- IRM_FLOW_ALLOC_RES = 14;
- IRM_FLOW_DEALLOC = 15;
- IPCP_FLOW_REQ_ARR = 16;
- IPCP_FLOW_ALLOC_REPLY = 17;
- IPCP_FLOW_DEALLOC = 18;
- IRM_REPLY = 19;
+ IRM_API_BIND = 9;
+ IRM_REG = 10;
+ IRM_UNREG = 11;
+ IRM_FLOW_ACCEPT = 12;
+ IRM_FLOW_ALLOC_RESP = 13;
+ IRM_FLOW_ALLOC = 14;
+ IRM_FLOW_ALLOC_RES = 15;
+ IRM_FLOW_DEALLOC = 16;
+ IPCP_FLOW_REQ_ARR = 17;
+ IPCP_FLOW_ALLOC_REPLY = 18;
+ IPCP_FLOW_DEALLOC = 19;
+ IRM_REPLY = 20;
};
message irm_msg {
required irm_msg_code code = 1;
optional string ap_name = 2;
- optional string ae_name = 3;
- optional sint32 api = 4;
- optional uint32 ipcp_type = 5;
- repeated string dif_name = 6;
- repeated string args = 7;
- optional sint32 response = 8;
- optional string dst_name = 9;
- optional sint32 port_id = 10;
- optional dif_config_msg conf = 11;
- optional uint32 opts = 12;
- repeated sint32 apis = 13;
- optional sint32 result = 14;
+ optional string ap_subset = 3;
+ optional string ae_name = 4;
+ optional sint32 api = 5;
+ optional uint32 ipcp_type = 6;
+ repeated string dif_name = 7;
+ repeated string args = 8;
+ optional sint32 response = 9;
+ optional string dst_name = 10;
+ optional sint32 port_id = 11;
+ optional dif_config_msg conf = 12;
+ optional uint32 opts = 13;
+ repeated sint32 apis = 14;
+ optional sint32 result = 15;
};