VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlInetInterfaceUtils.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2025 MAK Technologies, Inc
3 ** All rights reserved.
4 *********************************************************************/
9 #pragma once
10 
11 #include <vlutil/vlInet.h>
12 #include <vlutil/vlInetDevice.h>
13 #include <vlutil/vlString.h>
14 #include <vlutil/vlSmartPointers.h>
15 
16 #ifndef _WIN32
17 #include <netinet/if_ether.h>
18 #include <net/if.h>
19 #endif // !_WIN32
20 
21 #ifdef DtUSE_UTILITIES_NAMESPACE
22 namespace DtUSE_UTILITIES_NAMESPACE
23 {
24 #endif
25 
27 namespace DtInetUtils
28 {
31 #ifndef _WIN32
32 #ifdef __linux__
33 #define DtInet_INET6_PROC_PATH "/proc/net/if_inet6"
34 #define DtInet_IGMP_PROC_PATH "/proc/net/igmp"
35 #define DtInet_IGMP6_PROC_PATH "/proc/net/igmp6"
36 #endif // LINUX
37 #endif // !_WIN32
38 
40 
43 typedef std::vector<DtInetDeviceSP> DtHostDeviceList;
45 
50 
55 DT_DLL_VLUTIL DtHostDeviceList scanInetDevices( bool includeUpOnly, bool preferIpV6 = false );
56 
61 DT_DLL_VLUTIL DtHostDeviceList scanBroadcastDevices( bool includeUpOnly, bool preferIpV6 = false );
62 
67 DT_DLL_VLUTIL DtHostDeviceList scanMulticastDevices( bool includeUpOnly, bool preferIpV6 = false );
68 
72 DT_DLL_VLUTIL DtHostDeviceList scanIpv6Devices( bool includeUpOnly );
73 
77 
80 DT_DLL_VLUTIL DtInetDeviceSP defaultBroadcastDevice(bool preferIpv6 = false);
81 
82 #ifdef _WIN32
89  PIP_ADAPTER_ADDRESSES* adapterInfo, DtString& errorStr );
95 DT_DLL_VLUTIL int fetchIpv4DeviceAddrInfo( PMIB_IPADDRTABLE* ipv4Addrs,
96  DtString& errorStr );
97 #else // !_WIN32
98 #ifdef __solaris__
106  int sockFd, lifconf* ifc, unsigned int& buffSize,
107  unsigned int& resizeFactor, DtString& errorStr );
108 
111 DT_DLL_VLUTIL struct lifreq* findInterfaceByName( const char* ifName, int sock, lifconf* ifc );
112 DT_DLL_VLUTIL struct lifreq* findInterfaceByAddress( struct in_addr* ipv4Addr, int sock,
113  lifconf* ifc );
117 DT_DLL_VLUTIL struct ifreq_in6* findIpv6InterfaceByName( const char* ifName, int sock,
118  lifconf* ifc );
119 DT_DLL_VLUTIL struct ifreq_in6* findIpv6InterfaceByAddress( struct in6_addr* ipv6Addr,
120  int sock, lifconf* ifc );
123 
129 DT_DLL_VLUTIL int fetchIpv6DeviceInfo( int sockFd, lifconf* ifc, unsigned int& buffSize,
130  unsigned int& resizeFactor, DtString& errorStr );
131 
132 #else // !SOLARIS
140  int sockFd, ifconf* ifc, unsigned int& buffSize,
141  unsigned int& resizeFactor, DtString& errorStr );
142 
145 DT_DLL_VLUTIL struct ifreq* findInterfaceByName( const char* ifName, int sock, ifconf* ifc );
146 DT_DLL_VLUTIL struct ifreq* findInterfaceByAddress( struct in_addr* ipv4Addr, int sock,
147  ifconf* ifc );
151 DT_DLL_VLUTIL struct ifreq_in6* findIpv6InterfaceByName( const char* ifName, int sock,
152  ifconf* ifc );
153 DT_DLL_VLUTIL struct ifreq_in6* findIpv6InterfaceByAddress( struct in6_addr* ipv6Addr,
154  int sock, ifconf* ifc );
156 
157 #if defined(__linux__) || defined(__sgi__)
158 DT_DLL_VLUTIL int fetchIpv6DeviceInfo( int sockFd, ifconf* ifc, unsigned int& buffSize,
164  unsigned int& resizeFactor, DtString& errorStr );
165 #endif // LINUX
166 
167 #endif // !SOLARIS
168 #endif // !_WIN32
169 }
171 
172 #ifdef DtUSE_UTILITIES_NAMESPACE
173 }
174 #endif
175 
DtHostDeviceList scanMulticastDevices(bool includeUpOnly, bool preferIpV6=false)
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 mult...
Contains the DtString class declaration.
Includes utility functions for weak and shared pointers.
std::vector< DtInetDeviceSP > DtHostDeviceList
Definition: vlInetInterfaceUtils.h:43
int fetchDeviceInfo(DtInetUtils::DtInetAddrFamily type, int sockFd, ifconf *ifc, unsigned int &buffSize, unsigned int &resizeFactor, DtString &errorStr)
Returns a block of ifreq structs containing the adapter information associated with devices with an I...
DtHostDeviceList scanBroadcastDevices(bool includeUpOnly, bool preferIpV6=false)
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv4 broa...
DtString getLocalHostname()
Returns a list of DtInetInterface objects representing all IP network interfaces. ...
DtInetAddrFamily
Definition: vlInetAddrUtils.h:55
DtInetDeviceSP defaultMulticastDevice()
Returns the DtInetInterface object representing the default interface chosen for multicast communicat...
struct ifreq * findInterfaceByName(const char *ifName, int sock, ifconf *ifc)
Find a specific IPv4 device from a device configuration list (ifconf)
struct ifreq_in6 * findIpv6InterfaceByName(const char *ifName, int sock, ifconf *ifc)
Find a specific IPv6 device from a device configuration list (ifconf)
DtHostDeviceList scanIpv6Devices(bool includeUpOnly)
Returns a list of DtInetInterface objects representing all IP network interfaces capable of IPv6 comm...
struct ifreq * findInterfaceByAddress(struct in_addr *ipv4Addr, int sock, ifconf *ifc)
Returns a list of DtInetInterface objects representing all IP network interfaces. ...
struct ifreq_in6 * findIpv6InterfaceByAddress(struct in6_addr *ipv6Addr, int sock, ifconf *ifc)
Find a specific IPv6 device from a device configuration list (ifconf)
This file contains the declaration of the DtInetDevice class.
DtHostDeviceList scanInetDevices(bool includeUpOnly, bool preferIpV6=false)
Returns a list of DtInetInterface objects representing all IP network interfaces. ...
DtInetDeviceSP defaultBroadcastDevice(bool preferIpv6=false)
Returns the DtInetInterface object representing the default interface chosen for broadcast communicat...
Instances of DtString are used to represent strings.
Definition: vlString.h:36
std::shared_ptr< DtInetDevice > DtInetDeviceSP
Definition: vlInetDevice.h:98
Definition: vlInetDevice.h:76
This file declares useful defaults constants and static methods employed with the networking abstract...
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)