summaryrefslogtreecommitdiff
path: root/src/tools/echo/echo.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-06-13 13:48:17 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-06-13 13:48:17 +0200
commit7834e92b218da69cd934679dec9c2d714d89d15e (patch)
treee2174dd2810a20e90050481e2fd54ce61e414baf /src/tools/echo/echo.c
parentddfc7091d2698d36c1cfec49eaaad96b278bb37b (diff)
downloadouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.tar.gz
ouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.zip
lib, irmd, tools, ipcpd: updates to dev API.
The registration function has been moved to the irm tool, applications now need to be registered by an administrator. Currently only supports one instance per registered name, and an AP can be registered under only one name. The irmd can now start a registered server application on demand. For the full functionality of the tool, execute "irm register". AP name removed from flow allocation. Flow allocation does not send the source ap name as it is quite useless. The accept() call now only returns the AE name.
Diffstat (limited to 'src/tools/echo/echo.c')
-rw-r--r--src/tools/echo/echo.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/tools/echo/echo.c b/src/tools/echo/echo.c
index 849c0ca8..4484dc71 100644
--- a/src/tools/echo/echo.c
+++ b/src/tools/echo/echo.c
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <string.h>
-#define SERVER_AP_NAME "echo-server"
#define BUF_SIZE 256
#include "echo_client.c"
@@ -37,14 +36,22 @@ static void usage()
" --help Display this help text and exit\n");
}
-int main(int argc, char ** argv) {
+int main(int argc, char ** argv)
+{
+ int ret = -1;
+ if (ap_init(argv[0])) {
+ printf("Failed to init AP.\n");
+ return -1;
+ }
argc--;
argv++;
while (argc > 0) {
if (strcmp(*argv, "-l") == 0 ||
strcmp(*argv, "--listen") == 0) {
- return server_main();
+ ret = server_main();
+ ap_fini();
+ return ret;
} else {
usage();
return 0;
@@ -53,5 +60,9 @@ int main(int argc, char ** argv) {
argv++;
}
- return client_main();
+ ret = client_main();
+
+ ap_fini();
+
+ return ret;
}