diff options
author | Giovanni Conte <gconte@cisco.com> | 2019-01-28 15:08:16 +0100 |
---|---|---|
committer | Giovanni Conte <gconte@cisco.com> | 2019-01-29 09:30:37 +0000 |
commit | 07db19960166bd7241836b858ecf41420dafc63e (patch) | |
tree | 701705407796d61f7400456d12012a5ce0697dbe /hicn-light/src | |
parent | 015dd3fa693039acd08171e8a8d27b3776670a41 (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')
-rwxr-xr-x | hicn-light/src/config/configuration.c | 10 | ||||
-rwxr-xr-x | hicn-light/src/config/configurationListeners.c | 14 | ||||
-rwxr-xr-x | hicn-light/src/config/controlAddConnection.c | 32 | ||||
-rwxr-xr-x | hicn-light/src/core/forwarder.c | 2 | ||||
-rwxr-xr-x | hicn-light/src/core/forwarder.h | 2 | ||||
-rwxr-xr-x | hicn-light/src/core/messageHandler.h | 2 | ||||
-rwxr-xr-x | hicn-light/src/io/hicnConnection.c | 8 | ||||
-rwxr-xr-x | hicn-light/src/io/hicnConnection.h | 4 | ||||
-rwxr-xr-x | hicn-light/src/io/hicnListener.c | 64 | ||||
-rwxr-xr-x | hicn-light/src/io/hicnListener.h | 4 | ||||
-rwxr-xr-x | hicn-light/src/io/streamConnection.c | 8 |
11 files changed, 76 insertions, 74 deletions
diff --git a/hicn-light/src/config/configuration.c b/hicn-light/src/config/configuration.c index cccd60620..737605932 100755 --- a/hicn-light/src/config/configuration.c +++ b/hicn-light/src/config/configuration.c @@ -102,7 +102,7 @@ void configuration_Destroy(Configuration **configPtr) { *configPtr = NULL; } -struct iovec *configuration_ProcessRegisterHIcnPrefix(Configuration *config, +struct iovec *configuration_ProcessRegisterHicnPrefix(Configuration *config, struct iovec *request, unsigned ingressId) { header_control_message *header = request[0].iov_base; @@ -168,7 +168,7 @@ struct iovec *configuration_ProcessRegisterHIcnPrefix(Configuration *config, return response; } -struct iovec *configuration_ProcessUnregisterHIcnPrefix(Configuration *config, +struct iovec *configuration_ProcessUnregisterHicnPrefix(Configuration *config, struct iovec *request) { header_control_message *header = request[0].iov_base; remove_route_command *control = request[1].iov_base; @@ -292,6 +292,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config, response[1].iov_base = payloadResponse; response[1].iov_len = sizeof(list_routes_command) * payloadSize; + fibEntryList_Destroy(&fibList); return response; } @@ -578,6 +579,7 @@ struct iovec *configuration_ProcessConnectionList(Configuration *config, response[1].iov_len = sizeof(list_connections_command) * connectionList_Length(connList); + connectionList_Destroy(&connList); return response; } @@ -984,7 +986,7 @@ struct iovec *configuration_DispatchCommand(Configuration *config, case ADD_ROUTE: response = - configuration_ProcessRegisterHIcnPrefix(config, control, ingressId); + configuration_ProcessRegisterHicnPrefix(config, control, ingressId); break; case LIST_ROUTES: @@ -996,7 +998,7 @@ struct iovec *configuration_DispatchCommand(Configuration *config, break; case REMOVE_ROUTE: - response = configuration_ProcessUnregisterHIcnPrefix(config, control); + response = configuration_ProcessUnregisterHicnPrefix(config, control); break; case CACHE_STORE: diff --git a/hicn-light/src/config/configurationListeners.c b/hicn-light/src/config/configurationListeners.c index be30e2a49..0982a2b13 100755 --- a/hicn-light/src/config/configurationListeners.c +++ b/hicn-light/src/config/configurationListeners.c @@ -37,7 +37,7 @@ #include <src/utils/commands.h> #include <src/utils/utils.h> -static bool _setupHIcnListenerOnInet4(Forwarder *forwarder, +static bool _setupHicnListenerOnInet4(Forwarder *forwarder, const char *symbolic, Address *address) { bool success = false; #ifndef __APPLE__ @@ -45,14 +45,14 @@ static bool _setupHIcnListenerOnInet4(Forwarder *forwarder, hicnListener_CreateInet(forwarder, (char *)symbolic, address); if (ops != NULL) { success = listenerSet_Add(forwarder_GetListenerSet(forwarder), ops); - parcAssertTrue(success, "Failed to add HIcn listener %s to ListenerSet", + parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet", symbolic); } #endif /* __APPLE__ */ return success; } -static bool _setupHIcnListenerOnInet6(Forwarder *forwarder, +static bool _setupHicnListenerOnInet6(Forwarder *forwarder, const char *symbolic, Address *address) { bool success = false; #ifndef __APPLE__ @@ -60,7 +60,7 @@ static bool _setupHIcnListenerOnInet6(Forwarder *forwarder, hicnListener_CreateInet6(forwarder, (char *)symbolic, address); if (ops != NULL) { success = listenerSet_Add(forwarder_GetListenerSet(forwarder), ops); - parcAssertTrue(success, "Failed to add HIcn listener %s to ListenerSet", + parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet", symbolic); } #endif /* __APPLE__ */ @@ -149,7 +149,7 @@ bool _AddPuntingInet6(const Configuration *config, Punting *punting, Address *fakeAddr = addressCreateFromInet6((struct sockaddr_in6 *)addr); // comments: - // EncapType: I use the HIcn encap since the puting is available only for HIcn + // EncapType: I use the Hicn encap since the punting is available only for Hicn // listeners LocalAddress: The only listern for which we need punting rules is // the main one, which has no address // so I create a fake empty address. This need to be consistent @@ -297,7 +297,7 @@ bool _addHicn(Configuration *config, add_listener_command *control, case ADDR_INET: { localAddress = utils_AddressFromInet(&control->address.ipv4, &control->port); - success = _setupHIcnListenerOnInet4(configuration_GetForwarder(config), + success = _setupHicnListenerOnInet4(configuration_GetForwarder(config), symbolic, localAddress); break; } @@ -305,7 +305,7 @@ bool _addHicn(Configuration *config, add_listener_command *control, case ADDR_INET6: { localAddress = utils_AddressFromInet6(&control->address.ipv6, &control->port); - success = _setupHIcnListenerOnInet6(configuration_GetForwarder(config), + success = _setupHicnListenerOnInet6(configuration_GetForwarder(config), symbolic, localAddress); break; } diff --git a/hicn-light/src/config/controlAddConnection.c b/hicn-light/src/config/controlAddConnection.c index a0a966ddf..0603e37a5 100755 --- a/hicn-light/src/config/controlAddConnection.c +++ b/hicn-light/src/config/controlAddConnection.c @@ -43,9 +43,9 @@ static CommandReturn _controlAddConnection_Execute(CommandParser *parser, // =================================================== -static CommandReturn _controlAddConnection_HIcnHelpExecute( +static CommandReturn _controlAddConnection_HicnHelpExecute( CommandParser *parser, CommandOps *ops, PARCList *args); -static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser, +static CommandReturn _controlAddConnection_HicnExecute(CommandParser *parser, CommandOps *ops, PARCList *args); @@ -66,11 +66,11 @@ static CommandReturn _controlAddConnection_TcpExecute(CommandParser *parser, // =================================================== static const char *_commandAddConnection = "add connection"; -static const char *_commandAddConnectionHIcn = "add connection hicn"; +static const char *_commandAddConnectionHicn = "add connection hicn"; static const char *_commandAddConnectionUdp = "add connection udp"; static const char *_commandAddConnectionTcp = "add connection tcp"; static const char *_commandAddConnectionHelp = "help add connection"; -static const char *_commandAddConnectionHIcnHelp = "help add connection hicn"; +static const char *_commandAddConnectionHicnHelp = "help add connection hicn"; static const char *_commandAddConnectionUdpHelp = "help add connection udp"; static const char *_commandAddConnectionTcpHelp = "help add connection tcp"; @@ -90,9 +90,9 @@ CommandOps *controlAddConnection_HelpCreate(ControlState *state) { // =================================================== -static CommandOps *_controlAddConnection_HIcnCreate(ControlState *state) { - return commandOps_Create(state, _commandAddConnectionHIcn, NULL, - _controlAddConnection_HIcnExecute, +static CommandOps *_controlAddConnection_HicnCreate(ControlState *state) { + return commandOps_Create(state, _commandAddConnectionHicn, NULL, + _controlAddConnection_HicnExecute, commandOps_Destroy); } @@ -110,9 +110,9 @@ static CommandOps *_controlAddConnection_TcpCreate(ControlState *state) { // =================================================== -static CommandOps *_controlAddConnection_HIcnHelpCreate(ControlState *state) { - return commandOps_Create(state, _commandAddConnectionHIcnHelp, NULL, - _controlAddConnection_HIcnHelpExecute, +static CommandOps *_controlAddConnection_HicnHelpCreate(ControlState *state) { + return commandOps_Create(state, _commandAddConnectionHicnHelp, NULL, + _controlAddConnection_HicnHelpExecute, commandOps_Destroy); } @@ -134,7 +134,7 @@ static CommandReturn _controlAddConnection_HelpExecute(CommandParser *parser, CommandOps *ops, PARCList *args) { printf("Available commands:\n"); - printf(" %s\n", _commandAddConnectionHIcn); + printf(" %s\n", _commandAddConnectionHicn); printf(" %s\n", _commandAddConnectionUdp); printf(" %s\n", _commandAddConnectionTcp); printf("\n"); @@ -144,13 +144,13 @@ static CommandReturn _controlAddConnection_HelpExecute(CommandParser *parser, static void _controlAddConnection_Init(CommandParser *parser, CommandOps *ops) { ControlState *state = ops->closure; controlState_RegisterCommand(state, - _controlAddConnection_HIcnHelpCreate(state)); + _controlAddConnection_HicnHelpCreate(state)); controlState_RegisterCommand(state, _controlAddConnection_UdpHelpCreate(state)); controlState_RegisterCommand(state, _controlAddConnection_TcpHelpCreate(state)); - controlState_RegisterCommand(state, _controlAddConnection_HIcnCreate(state)); + controlState_RegisterCommand(state, _controlAddConnection_HicnCreate(state)); controlState_RegisterCommand(state, _controlAddConnection_UdpCreate(state)); controlState_RegisterCommand(state, _controlAddConnection_TcpCreate(state)); } @@ -269,14 +269,14 @@ static CommandReturn _controlAddConnection_IpHelp(CommandParser *parser, return CommandReturn_Success; } -static CommandReturn _controlAddConnection_HIcnHelpExecute( +static CommandReturn _controlAddConnection_HicnHelpExecute( CommandParser *parser, CommandOps *ops, PARCList *args) { _controlAddConnection_IpHelp(parser, ops, args, "hicn"); return CommandReturn_Success; } -static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser, +static CommandReturn _controlAddConnection_HicnExecute(CommandParser *parser, CommandOps *ops, PARCList *args) { static const int _indexSymbolic = 3; @@ -284,7 +284,7 @@ static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser, static const int _indexLocAddr = 5; if (parcList_Size(args) != 6) { - _controlAddConnection_HIcnHelpExecute(parser, ops, args); + _controlAddConnection_HicnHelpExecute(parser, ops, args); return CommandReturn_Failure; } diff --git a/hicn-light/src/core/forwarder.c b/hicn-light/src/core/forwarder.c index cb94af3b5..e84351365 100755 --- a/hicn-light/src/core/forwarder.c +++ b/hicn-light/src/core/forwarder.c @@ -439,7 +439,7 @@ PARCClock *forwarder_GetClock(const Forwarder *forwarder) { return forwarder->clock; } -hicn_socket_helper_t *forwarder_GetHIcnSocketHelper(Forwarder *forwarder) { +hicn_socket_helper_t *forwarder_GetHicnSocketHelper(Forwarder *forwarder) { return forwarder->hicnSocketHelper; } diff --git a/hicn-light/src/core/forwarder.h b/hicn-light/src/core/forwarder.h index ad3f9756b..e044add3b 100755 --- a/hicn-light/src/core/forwarder.h +++ b/hicn-light/src/core/forwarder.h @@ -240,7 +240,7 @@ void forwarder_ClearCache(Forwarder *forwarder); void forwarder_SetStrategy(Forwarder *forwarder, Name *prefix, strategy_type strategy); -hicn_socket_helper_t *forwarder_GetHIcnSocketHelper(Forwarder *forwarder); +hicn_socket_helper_t *forwarder_GetHicnSocketHelper(Forwarder *forwarder); #ifdef WITH_MAPME diff --git a/hicn-light/src/core/messageHandler.h b/hicn-light/src/core/messageHandler.h index d63656461..cf8ab3672 100755 --- a/hicn-light/src/core/messageHandler.h +++ b/hicn-light/src/core/messageHandler.h @@ -145,7 +145,7 @@ static inline size_t messageHandler_GetIPHeaderLength(unsigned ipVersion) { return 0; } -static inline bool messageHandler_IsValidHIcnPacket(const uint8_t *message) { +static inline bool messageHandler_IsValidHicnPacket(const uint8_t *message) { uint8_t version = messageHandler_GetIPPacketType(message); if (version == IPv6_TYPE || version == IPv4_TYPE) { return true; 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); |