summaryrefslogtreecommitdiffstats
path: root/hicn-light/src/io
diff options
context:
space:
mode:
authorGiovanni Conte <gconte@cisco.com>2019-01-28 15:08:16 +0100
committerGiovanni Conte <gconte@cisco.com>2019-01-29 09:30:37 +0000
commit07db19960166bd7241836b858ecf41420dafc63e (patch)
tree701705407796d61f7400456d12012a5ce0697dbe /hicn-light/src/io
parent015dd3fa693039acd08171e8a8d27b3776670a41 (diff)
[HICN-16] File Descriptors fixes for list commands
Change-Id: I052013d0d8c6c2bd4b7631c68065bca91024646b Signed-off-by: Giovanni Conte <gconte@cisco.com>
Diffstat (limited to 'hicn-light/src/io')
-rwxr-xr-xhicn-light/src/io/hicnConnection.c8
-rwxr-xr-xhicn-light/src/io/hicnConnection.h4
-rwxr-xr-xhicn-light/src/io/hicnListener.c64
-rwxr-xr-xhicn-light/src/io/hicnListener.h4
-rwxr-xr-xhicn-light/src/io/streamConnection.c8
5 files changed, 44 insertions, 44 deletions
diff --git a/hicn-light/src/io/hicnConnection.c b/hicn-light/src/io/hicnConnection.c
index 85cf50921..6def8ed43 100755
--- a/hicn-light/src/io/hicnConnection.c
+++ b/hicn-light/src/io/hicnConnection.c
@@ -14,7 +14,7 @@
*/
/**
- * Embodies the reader/writer for a HIcn connection
+ * Embodies the reader/writer for a Hicn connection
*
* NB The Send() function may overflow the output buffer
*
@@ -112,7 +112,7 @@ static IoOperations _template = {.closure = NULL,
// =================================================================
-static void _setConnectionState(_HicnState *HIcn, bool isUp);
+static void _setConnectionState(_HicnState *Hicn, bool isUp);
static bool _saveSockaddr(_HicnState *hicnConnState, const AddressPair *pair);
static void _refreshProbeDestAddress(_HicnState *hicnConnState,
const uint8_t *message);
@@ -150,7 +150,7 @@ IoOperations *hicnConnection_Create(Forwarder *forwarder, int fd,
char *str = addressPair_ToString(hicnConnState->addressPair);
logger_Log(hicnConnState->logger, LoggerFacility_IO, PARCLogLevel_Info,
__func__,
- "HIcnConnection %p created for address %s (isLocal %d)",
+ "HicnConnection %p created for address %s (isLocal %d)",
(void *)hicnConnState, str, hicnConnState->isLocal);
free(str);
}
@@ -196,7 +196,7 @@ static void _destroy(IoOperations **opsPtr) {
if (logger_IsLoggable(hicnConnState->logger, LoggerFacility_IO,
PARCLogLevel_Info)) {
logger_Log(hicnConnState->logger, LoggerFacility_IO, PARCLogLevel_Info,
- __func__, "HIcnConnection %p destroyed", (void *)hicnConnState);
+ __func__, "HicnConnection %p destroyed", (void *)hicnConnState);
}
// XXX
diff --git a/hicn-light/src/io/hicnConnection.h b/hicn-light/src/io/hicnConnection.h
index 757e534ba..930e2d470 100755
--- a/hicn-light/src/io/hicnConnection.h
+++ b/hicn-light/src/io/hicnConnection.h
@@ -15,7 +15,7 @@
/**
* @file hicnConnection.h
- * @brief Represents a HIcn connection for the connection table
+ * @brief Represents a Hicn connection for the connection table
*
* <#Detailed Description#>
*
@@ -30,7 +30,7 @@
#include <src/utils/address.h>
/**
- * Creates a HIcn connection that can send to the remote address
+ * Creates a Hicn connection that can send to the remote address
*
* The address pair must both be same type (i.e. INET or INET6).
*
diff --git a/hicn-light/src/io/hicnListener.c b/hicn-light/src/io/hicnListener.c
index 161f5b317..789face90 100755
--- a/hicn-light/src/io/hicnListener.c
+++ b/hicn-light/src/io/hicnListener.c
@@ -119,9 +119,9 @@ static bool _isEmptyAddressIPv4(Address *address) {
ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
Address *address) {
- HIcnListener *hicn = parcMemory_AllocateAndClear(sizeof(HIcnListener));
+ HicnListener *hicn = parcMemory_AllocateAndClear(sizeof(HicnListener));
parcAssertNotNull(hicn, "parcMemory_AllocateAndClear(%zu) returned NULL",
- sizeof(HIcnListener));
+ sizeof(HicnListener));
hicn->forwarder = forwarder;
hicn->logger = logger_Acquire(forwarder_GetLogger(forwarder));
@@ -134,7 +134,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
hicn->connection_id = -1;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(forwarder);
+ forwarder_GetHicnSocketHelper(forwarder);
if (_isEmptyAddressIPv4(address)) {
hicn->hicn_fd = hicn_socket(hicnSocketHelper, symbolic, NULL);
@@ -158,7 +158,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
PARCLogLevel_Debug)) {
logger_Log(
hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s: error while creating an hicn listener in lib_hicn",
+ "HicnListener %s: error while creating an hicn listener in lib_hicn",
symbolic);
}
logger_Release(&hicn->logger);
@@ -190,7 +190,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
if (logger_IsLoggable(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug)) {
logger_Log(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s created", symbolic);
+ "HicnListener %s created", symbolic);
}
return ops;
@@ -199,9 +199,9 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
Address *address) {
- HIcnListener *hicn = parcMemory_AllocateAndClear(sizeof(HIcnListener));
+ HicnListener *hicn = parcMemory_AllocateAndClear(sizeof(HicnListener));
parcAssertNotNull(hicn, "parcMemory_AllocateAndClear(%zu) returned NULL",
- sizeof(HIcnListener));
+ sizeof(HicnListener));
hicn->forwarder = forwarder;
hicn->logger = logger_Acquire(forwarder_GetLogger(forwarder));
@@ -219,7 +219,7 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
//address we just need to set the right type of packet
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(forwarder);
+ forwarder_GetHicnSocketHelper(forwarder);
if (_isEmptyAddressIPv6(address)) {
// create main listener
@@ -248,7 +248,7 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
PARCLogLevel_Debug)) {
logger_Log(
hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s: error while creating an hicn listener in lib_hicn",
+ "HicnListener %s: error while creating an hicn listener in lib_hicn",
symbolic);
}
logger_Release(&hicn->logger);
@@ -280,16 +280,16 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
if (logger_IsLoggable(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug)) {
logger_Log(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s created", symbolic);
+ "HicnListener %s created", symbolic);
}
return ops;
}
bool _hicnListener_BindInet6(ListenerOps *ops, const Address *remoteAddress) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
struct sockaddr_in6 *tmpAddr =
parcMemory_AllocateAndClear(sizeof(struct sockaddr_in6));
@@ -319,9 +319,9 @@ bool _hicnListener_BindInet6(ListenerOps *ops, const Address *remoteAddress) {
}
bool _hicnListener_BindInet(ListenerOps *ops, const Address *remoteAddress) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
struct sockaddr_in *tmpAddr =
parcMemory_AllocateAndClear(sizeof(struct sockaddr_in));
@@ -362,9 +362,9 @@ bool hicnListener_Bind(ListenerOps *ops, const Address *remoteAddress) {
}
bool hicnListener_Punting(ListenerOps *ops, const char *prefix) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
int res = hicn_listen(hicnSocketHelper, hicn->hicn_fd, prefix);
int retry = 0;
@@ -388,7 +388,7 @@ bool hicnListener_Punting(ListenerOps *ops, const char *prefix) {
}
bool hicnListener_SetConnectionId(ListenerOps *ops, unsigned connId) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
if (hicn) {
hicn->connection_id = connId;
return true;
@@ -396,12 +396,12 @@ bool hicnListener_SetConnectionId(ListenerOps *ops, unsigned connId) {
return false;
}
-static void _hicnListener_Destroy(HIcnListener **listenerPtr) {
+static void _hicnListener_Destroy(HicnListener **listenerPtr) {
parcAssertNotNull(listenerPtr, "Parameter must be non-null double pointer");
parcAssertNotNull(*listenerPtr,
"Parameter must derefernce to non-null pointer");
- HIcnListener *hicn = *listenerPtr;
+ HicnListener *hicn = *listenerPtr;
// close(hicn->hicn_fd); //XXX close the fd in the hicnlib (detroy listener?)
dispatcher_DestroyNetworkEvent(forwarder_GetDispatcher(hicn->forwarder),
@@ -414,32 +414,32 @@ static void _hicnListener_Destroy(HIcnListener **listenerPtr) {
static void _destroy(ListenerOps **listenerOpsPtr) {
ListenerOps *ops = *listenerOpsPtr;
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
_hicnListener_Destroy(&hicn);
parcMemory_Deallocate((void **)&ops);
*listenerOpsPtr = NULL;
}
static unsigned _getInterfaceIndex(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->conn_id;
}
static const Address *_getListenAddress(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->localAddress;
}
static EncapType _getEncapType(const ListenerOps *ops) { return ENCAP_HICN; }
static int _getSocket(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->hicn_fd;
}
// ===============================
-static void _readFrameToDiscard(HIcnListener *hicn, int fd) {
+static void _readFrameToDiscard(HicnListener *hicn, int fd) {
// we need to discard the frame. Read 1 byte. This will clear it off the
// stack.
uint8_t buffer;
@@ -463,7 +463,7 @@ static void _readFrameToDiscard(HIcnListener *hicn, int fd) {
}
}
-static unsigned _createNewConnection(HIcnListener *hicn, int fd,
+static unsigned _createNewConnection(HicnListener *hicn, int fd,
const AddressPair *pair) {
bool isLocal = false;
@@ -477,7 +477,7 @@ static unsigned _createNewConnection(HIcnListener *hicn, int fd,
return connid;
}
-const Connection *_findConnectionFromPacket(HIcnListener *hicn,
+const Connection *_findConnectionFromPacket(HicnListener *hicn,
Address *packetSourceAddress) {
const Connection *conn = NULL;
if (hicn->connection_id != -1) {
@@ -520,7 +520,7 @@ static Address *_createAddressFromPacket(uint8_t *msgBuffer) {
return packetAddr;
}
-static void _handleProbeMessage(HIcnListener *hicn, uint8_t *msgBuffer) {
+static void _handleProbeMessage(HicnListener *hicn, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr != NULL) {
@@ -536,7 +536,7 @@ static void _handleProbeMessage(HIcnListener *hicn, uint8_t *msgBuffer) {
parcMemory_Deallocate((void **)&msgBuffer);
}
-static void _handleWldrNotification(HIcnListener *hicn, uint8_t *msgBuffer) {
+static void _handleWldrNotification(HicnListener *hicn, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr == NULL) {
@@ -563,7 +563,7 @@ static void _handleWldrNotification(HIcnListener *hicn, uint8_t *msgBuffer) {
}
#ifdef WITH_MAPME
-static void _handleMapMe(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
+static void _handleMapMe(HicnListener *hicn, int fd, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr == NULL) {
@@ -630,7 +630,7 @@ static void _handleMapMe(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
}
#endif /* WITH_MAPME */
-static Message *_readMessage(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
+static Message *_readMessage(HicnListener *hicn, int fd, uint8_t *msgBuffer) {
Message *message = NULL;
ssize_t readLength = read(fd, msgBuffer, MTU_SIZE);
@@ -702,7 +702,7 @@ static Message *_readMessage(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
return message;
}
-static void _receivePacket(HIcnListener *hicn, int fd) {
+static void _receivePacket(HicnListener *hicn, int fd) {
Message *msg = NULL;
uint8_t *msgBuffer = parcMemory_AllocateAndClear(MTU_SIZE);
msg = _readMessage(hicn, fd, msgBuffer);
@@ -713,7 +713,7 @@ static void _receivePacket(HIcnListener *hicn, int fd) {
}
static void _hicnListener_readcb(int fd, PARCEventType what, void *hicnVoid) {
- HIcnListener *hicn = (HIcnListener *)hicnVoid;
+ HicnListener *hicn = (HicnListener *)hicnVoid;
if (hicn->inetFamily == IPv4 || hicn->inetFamily == IPv6) {
if (what & PARCEventType_Read) {
diff --git a/hicn-light/src/io/hicnListener.h b/hicn-light/src/io/hicnListener.h
index 98c5387c9..5897d33ad 100755
--- a/hicn-light/src/io/hicnListener.h
+++ b/hicn-light/src/io/hicnListener.h
@@ -15,7 +15,7 @@
/**
* @file hicnListener.h
- * @brief Listens for in coming HIcn connections
+ * @brief Listens for in coming Hicn connections
*
*
*/
@@ -29,7 +29,7 @@
#include <stdlib.h>
struct hicn_listener;
-typedef struct hicn_listener HIcnListener;
+typedef struct hicn_listener HicnListener;
ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
Address *address);
diff --git a/hicn-light/src/io/streamConnection.c b/hicn-light/src/io/streamConnection.c
index fedbb157a..948b6c01b 100755
--- a/hicn-light/src/io/streamConnection.c
+++ b/hicn-light/src/io/streamConnection.c
@@ -504,13 +504,13 @@ PARCEventBuffer *_tryReadControlMessage(_StreamState *stream,
return NULL;
}
-static bool _isAnHIcnPacket(PARCEventBuffer *input) {
+static bool _isAnHicnPacket(PARCEventBuffer *input) {
size_t bytesAvailable = parcEventBuffer_GetLength(input);
parcAssertTrue(bytesAvailable >= sizeof(header_control_message),
"Called with too short an input: %zu", bytesAvailable);
uint8_t *fh = parcEventBuffer_Pullup(input, sizeof(header_control_message));
- return messageHandler_IsValidHIcnPacket(fh);
+ return messageHandler_IsValidHicnPacket(fh);
}
static Message *_readMessage(_StreamState *stream, Ticks time,
@@ -607,8 +607,8 @@ static void _conn_readcb(PARCEventQueue *event, PARCEventType type,
parcEventBuffer_Destroy(&message);
}
- } else if (_isAnHIcnPacket(input)) {
- // this is an HIcn packet (here we should distinguish between IPv4 and
+ } else if (_isAnHicnPacket(input)) {
+ // this is an Hicn packet (here we should distinguish between IPv4 and
// IPv6 tryReadMessage may set nextMessageLength
Message *message = _tryReadMessage(input, stream);