This is Unofficial EPICS BASE Doxygen Site
inetAddressUtil.h
Go to the documentation of this file.
1 
7 #ifndef INETADDRESSUTIL_H_
8 #define INETADDRESSUTIL_H_
9 
10 #include <vector>
11 
12 #include <osiSock.h>
13 #include <shareLib.h>
14 
15 #include <pv/pvType.h>
16 #include <pv/byteBuffer.h>
17 
18 namespace epics {
19 namespace pvAccess {
20 
21 typedef std::vector<osiSockAddr> InetAddrVector;
22 
23 struct ifaceNode {
25  peer,
26  bcast,
27  mask;
28  bool loopback,
29  validP2P,
30  validBcast;
31  ifaceNode();
32 };
33 typedef std::vector<ifaceNode> IfaceNodeVector;
34 epicsShareFunc int discoverInterfaces(IfaceNodeVector &list, SOCKET socket, const osiSockAddr *pMatchAddr = 0);
35 
42 
50 
56 epicsShareFunc bool isMulticastAddress(const osiSockAddr* address);
57 
66 epicsShareFunc void getSocketAddressList(InetAddrVector& ret, const std::string & list, int defaultPort,
67  const InetAddrVector* appendList = NULL);
68 
70  bool displayPort = true, bool displayHex = false);
71 
72 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
73 
74 // comparators for osiSockAddr
75 
77  bool operator()(const osiSockAddr& a, const osiSockAddr& b) const {
78  if(a.sa.sa_family<b.sa.sa_family) return true;
79  if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
80  <b.ia.sin_addr.s_addr)) return true;
81  if((a.sa.sa_family==b.sa.sa_family)&&(a.ia.sin_addr.s_addr
82  ==b.ia.sin_addr.s_addr)&&(a.ia.sin_port
83  <b.ia.sin_port)) return true;
84  return false;
85  }
86 };
87 
88 }} // namespace epics::pvAccess
89 
90 #endif /* INETADDRESSUTIL_H_ */
bool validBcast
true if bcast and mask have been set
struct sockaddr sa
Definition: osiSock.h:158
struct sockaddr_in ia
Definition: osiSock.h:157
#define epicsShareFunc
Definition: shareLib.h:209
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
#define NULL
Definition: catime.c:38
Mark external symbols and entry points for shared libraries.
osiSockAddr mask
Net mask.
osiSockAddr peer
point to point peer
osiSockAddr addr
Our address.
std::vector< osiSockAddr > InetAddrVector
void encodeAsIPv6Address(ByteBuffer *buffer, const osiSockAddr *address)
std::vector< ifaceNode > IfaceNodeVector
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
Definition: byteBuffer.h:233
int SOCKET
Definition: osdSock.h:31
bool decodeAsIPv6Address(ByteBuffer *buffer, osiSockAddr *address)
bool isMulticastAddress(const osiSockAddr *address)
void getSocketAddressList(InetAddrVector &ret, const std::string &list, int defaultPort, const InetAddrVector *appendList)
bool operator()(const osiSockAddr &a, const osiSockAddr &b) const
bool validP2P
true if peer has been set.
osiSockAddr bcast
sub-net broadcast address
string inetAddressToString(const osiSockAddr &addr, bool displayPort, bool displayHex)
int discoverInterfaces(IfaceNodeVector &list, SOCKET socket, const osiSockAddr *pMatchAddr)