aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/core/connection.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-04-16 14:39:50 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-04-16 15:37:53 +0200
commit3ed2badca49b8c7e636d8f8c40f532a7d3a7ba29 (patch)
treef865fe39515b3a496bfeee7ad8ef73916104caf4 /hicn-light/src/hicn/core/connection.c
parentc365689250216861fd7727203ee6ba1049ad5778 (diff)
[HICN-177] Provide helpers to send, receive and process control messages
Change-Id: I5f7270568eaf24858346edebc638cf51e28cc5ad Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/core/connection.c')
-rw-r--r--hicn-light/src/hicn/core/connection.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/core/connection.c b/hicn-light/src/hicn/core/connection.c
index 36fb20ec9..61db61ba7 100644
--- a/hicn-light/src/hicn/core/connection.c
+++ b/hicn-light/src/hicn/core/connection.c
@@ -45,6 +45,7 @@ struct connection {
// file/hicnLightControl) this value is set to false so
// that a base station can not disable wldr at the client
Wldr *wldr;
+
};
Connection *connection_Create(IoOperations *ops) {
@@ -112,11 +113,12 @@ bool connection_Send(const Connection *conn, Message *message) {
return false;
}
-bool connection_SendCommandResponse(const Connection *conn, struct iovec *msg){
+bool connection_SendIOVBuffer(const Connection *conn, struct iovec *msg,
+ size_t size) {
parcAssertNotNull(conn, "Parameter conn must be non-null");
parcAssertNotNull(msg, "Parameter message must be non-null");
- return ioOperations_SendCommandResponse(conn->ops, msg);
+ return ioOperations_SendIOVBuffer(conn->ops, msg, size);
}
static void _sendProbe(Connection *conn, unsigned probeType, uint8_t *message) {
@@ -132,6 +134,14 @@ static void _sendProbe(Connection *conn, unsigned probeType, uint8_t *message) {
}
}
+bool connection_SendBuffer(const Connection *conn, u8 * buffer, size_t length)
+{
+ struct iovec iov[1];
+ iov[0].iov_base = buffer;
+ iov[0].iov_len = length;
+ return connection_SendIOVBuffer(conn, iov, 1);
+}
+
void connection_Probe(Connection *conn) {
_sendProbe(conn, PACKET_TYPE_PROBE_REQUEST, NULL);
}