2 * FILE: $Header: /home/egg/src/RCS/network.h,v 1.6 1999/02/28 20:14:26 ghn Exp $
3 * PURPOSE: Definitions for network communication functions
9 * Revision 1.6 1999/02/28 20:14:26 ghn
10 * Version 5.1: Modified InitNetwork to take interface (addr) argument as
11 * well as port, and handle various cases of interface (NULL, IP,
12 * hostname) gracefully. Modified NetUp to call this new version.
14 * Revision 1.5 1999/01/02 00:02:24 ghn
15 * Modified NetTalk() api to offer "gripe" argument to silence some perror()s.
17 * Revision 1.4 1998/12/31 22:11:05 ghn
18 * Rev 5 code: includes multi-reg support, HTML, etc.
20 * Revision 1.3 1998/08/01 18:51:25 ghn
21 * Added John's byte-order-independence changes.
23 * Revision 1.2 1998/08/01 17:17:40 ghn
26 * Revision 1.1 1998/07/21 11:36:34 ghn
29 * Copyright 1998 - Greg Nelson
30 * Redistributable under the terms of the GNU Public Licence (GPL)
36 #include <netinet/in.h>
40 #define BASKETPORT 2075
43 #define BASKETPORT 2510
46 /* Initialize network subsystem, returning socket descriptor */
47 extern int32 InitNetwork(char *addr, int32 port);
49 /* Bring net up with command */
50 extern int32 NetUp(char *cmd, char *addr, int32 port);
52 /* Bring net down with command */
53 extern int NetDown(char *cmd, int32 oldsd);
55 /* Get a sockaddr given a host and port */
56 extern int NetGetAddr(struct sockaddr_in *sin, char *host, uint16 port);
58 /* Listen for a data request.
60 Listen on specified socket sd. When one is received, validate the
61 checksum, and, if successful, allocate memory and stuff it as a
62 character array. Return the remote sockaddr_in, if the sin pointer
63 is not null, and block until something interesting happens if block
65 extern int NetListen(int sd, char **pktbuf,
66 struct sockaddr_in *sin,
69 /* Send a data packet.
71 Create a socket, checksum the packet, and send it to the specified
72 addr in sin. Length of packet to be extracted from packet
74 extern int NetTalk(struct sockaddr_in *sin, char *pkt, int gripe);
76 #endif /* !_NETWORK_H */