NLSR API Version 2.0
diff --git a/nlsr.c b/nlsr.c
index 189e11f..f983557 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -597,6 +597,18 @@
return 0;
}
+char *
+process_api_client_command(char *command)
+{
+ char *msg;
+ msg=(char *)malloc(100);
+ memset(msg,100,0);
+ strcpy(msg,"Action Carried Out for NLSR Api Client");
+
+
+
+ return msg;
+}
int
nlsr_api_server_poll(long int time_out_micro_sec, int ccn_fd)
@@ -655,9 +667,11 @@
{
recv(fd, recv_buffer, 1024, 0);
printf("Received Data from NLSR API cleint: %s \n",recv_buffer);
+ char *msg=process_api_client_command(recv_buffer);
+ send(fd, msg, strlen(msg),0);
+ free(msg);
close(fd);
FD_CLR(fd, &nlsr->readfds);
- free(recv_buffer);
}
}
}
diff --git a/nlsrc.c b/nlsrc.c
index e980687..20e199f 100755
--- a/nlsrc.c
+++ b/nlsrc.c
@@ -28,7 +28,7 @@
struct sockaddr_un address;
int result;
int byteSend;
-
+
int command_len=0;
int i;
@@ -37,6 +37,9 @@
if ( strcmp(argv[2],"neighbor") == 0 && argc <5 )
usage(argv[0]);
+ char recv_buffer[1024];
+ bzero(recv_buffer,1024);
+
for(i=1;i<argc;i++)
command_len+=(strlen(argv[i])+1);
char *command=malloc(command_len);
@@ -58,8 +61,10 @@
perror("oops nlsrc ");
exit(1);
}
- printf("Data to send: %s \n",command);
+ printf("Command to send: %s \n",command);
byteSend=send(sockfd, command, strlen(command),0);
+ recv(sockfd, recv_buffer, 1024, 0);
+ printf("%s\n",recv_buffer);
free(command);
close(sockfd);
exit(0);