summaryrefslogtreecommitdiffstats
path: root/hicn-light/src/config
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/config
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/config')
-rwxr-xr-xhicn-light/src/config/configuration.c10
-rwxr-xr-xhicn-light/src/config/configurationListeners.c14
-rwxr-xr-xhicn-light/src/config/controlAddConnection.c32
3 files changed, 29 insertions, 27 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;
}