summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-05-03 14:12:22 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-05-03 14:12:22 +0000
commite6e9e637d189d0f52999dfbeecdaa24e0116514b (patch)
tree07908d8abed579ccaf4bf172ef833a30b6e48787
parent55316056509a4e5c889a6afc37c7ddbb3d368867 (diff)
Update from Eric Norum <eric@cls.usask.ca>.
-rw-r--r--rpc_demo/Makefile5
-rw-r--r--rpc_demo/init.c31
-rw-r--r--rpc_demo/msg_main.c2
-rw-r--r--rpc_demo/rprintmsg.c16
4 files changed, 33 insertions, 21 deletions
diff --git a/rpc_demo/Makefile b/rpc_demo/Makefile
index f923bb6..8e14bda 100644
--- a/rpc_demo/Makefile
+++ b/rpc_demo/Makefile
@@ -14,10 +14,11 @@ MANAGERS=io event semaphore timer
# C source names, if any, go here -- minus the .c
ifdef SERVER
-C_PIECES= init rprintmsg msg_clnt
+C_PIECES= rprintmsg msg_clnt
else
-C_PIECES= init msg_main msg_proc
+C_PIECES= msg_main msg_proc
endif
+C_PIECES += init
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/rpc_demo/init.c b/rpc_demo/init.c
index 4ef82cf..aba4416 100644
--- a/rpc_demo/init.c
+++ b/rpc_demo/init.c
@@ -29,12 +29,28 @@ rtems_task Init(rtems_task_argument argument);
/*
* Network configuration
*/
-#define NETWORK_TASK_PRIORITY 50
+extern void rtems_bsdnet_loopattach();
+static struct rtems_bsdnet_ifconfig loopback_config = {
+ "lo0", /* name */
+ rtems_bsdnet_loopattach, /* attach function */
+
+ NULL, /* link to next interface */
+
+ "127.0.0.1", /* IP address */
+ "255.0.0.0", /* IP net mask */
+};
+
+/*
+ * Default network interface
+ */
static struct rtems_bsdnet_ifconfig netdriver_config = {
- RTEMS_BSP_NETWORK_DRIVER_NAME,
- RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+ RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
+ RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
+ &loopback_config, /* link to next interface */
};
+#define NETWORK_TASK_PRIORITY 50
+
struct rtems_bsdnet_config rtems_bsdnet_config = {
&netdriver_config, /* Network interface */
rtems_bsdnet_do_bootp, /* Use BOOTP to get network configuration */
@@ -66,6 +82,13 @@ Init (rtems_task_argument ignored)
rtems_bsdnet_initialize_network ();
rtems_bsdnet_synchronize_ntp (0, 0);
+#ifndef SERVER
+ /*
+ * We are the server
+ */
+ rtems_rpc_start_portmapper (100);
+#endif
+
rtems_main (ac, av);
printf ("*** RPC Test Finish ***\n");
exit (0);
@@ -73,6 +96,6 @@ Init (rtems_task_argument ignored)
/*
* Dummy portmapper routines
- */
pmap_set () { ; }
pmap_unset () { ; }
+ */
diff --git a/rpc_demo/msg_main.c b/rpc_demo/msg_main.c
index 58b0f7e..e7849cf 100644
--- a/rpc_demo/msg_main.c
+++ b/rpc_demo/msg_main.c
@@ -50,7 +50,7 @@ main (int argc, char **argv)
fprintf (stderr, "cannot create tcp service.");
return 1;
}
- if (!svc_register(transp, MESSAGEPROC, MESSAGEVERS, messageproc_1, 0)) {
+ if (!svc_register(transp, MESSAGEPROC, MESSAGEVERS, messageproc_1, IPPROTO_TCP)) {
fprintf (stderr, "unable to register (MESSAGEPROC, MESSAGEVERS, tcp).\n");
return 3;
}
diff --git a/rpc_demo/rprintmsg.c b/rpc_demo/rprintmsg.c
index 708e853..20ab262 100644
--- a/rpc_demo/rprintmsg.c
+++ b/rpc_demo/rprintmsg.c
@@ -30,23 +30,11 @@ main (int argc, char **argv)
}
server = argv[1];
message = argv[2];
- hp = gethostbyname (server);
- if (hp == NULL) {
- fprintf (stderr, "No server %s\n", server);
- return 2;
- }
-
- /*
- * Set up server address
- */
- farAddr.sin_family = hp->h_addrtype;
- farAddr.sin_port = htons (TCP_PORT);
- memcpy((char*)&farAddr.sin_addr, hp->h_addr, hp->h_length);
/*
- * Create connection to server
+ * Create a connection
*/
- c1 = clnttcp_create (&farAddr, MESSAGEPROC, MESSAGEVERS, &sock, 0, 0);
+ c1 = clnt_create (server, MESSAGEPROC, MESSAGEVERS, "tcp");
if (c1 == NULL) {
clnt_pcreateerror (server);
return 3;