EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
NetTools.h
1 #ifndef __NETTOOLS_H__
2 #define __NETTOOLS_H__
3 
4 // Tools for network code
5 //
6 // 4/1999, -kuk-
7 
8 #include "tools/ToolsConfig.h"
9 
10 #ifdef solaris
11 // Hack around clash of struct map in inet headers with std::map
12 #define map xxxMapxxx
13 #endif
14 
15 #include <osiSock.h>
16 
17 #ifdef solaris
18 #undef map
19 #endif
20 
21 #ifdef Linux
22 #include<sys/types.h>
23 #include<sys/socket.h>
24 #endif
25 
26 // Convert the given address into a string "<IP> (<port>)"
27 void GetSocketAddrInfo (const sockaddr_in &sin, stdString &text);
28 
29 // Get info for socket: local address, peer's address
30 void GetSocketLocal (SOCKET sock, stdString &local);
31 void GetSocketPeer (SOCKET sock, stdString &peer);
32 void GetSocketInfo (SOCKET sock, stdString &local, stdString &peer);
33 
34 #ifdef WIN32
35 // Create a broadcast socket, bound to port.
36 // Returns a sockaddr for broadcasting also.
37 bool CreateBroadcastSocket (int port /*I*/, SOCKET &sock /*O*/,
38  int peer_port, sockaddr_in &broadcast /*O*/);
39 
40 // Get description for the last error
41 const char *GetSocketErrorString ();
42 #endif
43 
44 #endif //__NETTOOLS_H__