1: #include <stdio.h>
2: #include <sys/types.h>
3: #include <netns/ns.h>
4: #include <netns/sp.h>
5: #include "Clearinghouse2_defs.h"
6: #include <xnscourier/except.h>
7:
8: main(argc, argv)
9: int argc;
10: char *argv[];
11: {
12: RetrieveAddressesResults result;
13: struct ns_addr *destaddr;
14: CourierConnection *conn;
15: NetworkAddress na;
16: extern struct ns_addr *getXNSaddr();
17: int i;
18:
19: if (argc == 1)
20: /* default to CornellS1 2-273, 2-852-151-014 */
21: destaddr = getXNSaddr("8E0#00.00.AA.00.7D.E7");
22: else if (argc != 2 || (destaddr = getXNSaddr(argv[1]))==NULL) {
23: fprintf(stderr,"Usage: %s machine\n",argv[0]);
24: exit(1);
25: }
26: if ((conn = CourierOpen(destaddr)) == NULL) {
27: fprintf(stderr,"Can't open connection to %s\n",argv[1]);
28: exit(1);
29: }
30: DURING
31: result = RetrieveAddresses(conn,NULL);
32: HANDLER {
33: switch (Exception.Code) {
34: case CallError:
35: fprintf(stderr,"Call error, %d\n",
36: CourierErrArgs(CallErrorArgs,problem));
37: break;
38: default:
39: fprintf(stderr,"Some random error, code %d\n",
40: Exception.Code);
41: break;
42: }
43: exit(1);
44: } END_HANDLER;
45:
46: for (i = 0; i < result.addresses.length; i++) {
47: na = result.addresses.sequence[i];
48: printf("address: network %x %x, host %x, %x, %x, socket %x\n",
49: na.network[0],na.network[1],
50: na.host[0],na.host[1],na.host[2],
51: na.socket);
52: }
53: }
Defined functions
main
defined in line
8;
never used