Google은 흑인 공동체를 위한 인종적 평등을 추구하기 위해 노력하고 있습니다. 자세히 알아보기

nl::Inet::InterfaceAddressIterator

#include <src/inet/InetInterface.h>

시스템 네트워크 인터페이스 IP 주소 목록의 반복자입니다.

요약

이 클래스의 객체를 사용하여 시스템 네트워크 인터페이스 인터페이스 IP 주소 목록을 반복합니다.

이 클래스의 개별 인스턴스에 관한 메서드는 스레드로부터 안전하지 않습니다. 그러나 별도의 인스턴스는 여러 스레드에서 동시에 사용할 수 있습니다.

멀티스레드 LwIP 시스템에서 인스턴스는 전역 LwIP 상태에 액세스하는 다른 스레드에 비해 스레드로부터 안전합니다. 1) 다른 스레드가 netif 목록 변경을 변형하면서 LwIP 코어 잠금을 보유하며 2) netif 객체 자체가 절대로 소멸되지 않습니다.

소켓 기반 시스템에서는 기본 시스템의 인터페이스 및 주소가 변경될 때 반복이 항상 안정적입니다.

LwIP 시스템에서는 현재 주소와 연결된 인터페이스가 삭제되는 경우 반복이 안정적이므로 반복이 조기에 종료될 수 있습니다.

생성자 및 소멸자

InterfaceAddressIterator(void)
InterfaceAddressIterator 객체를 생성합니다.
~InterfaceAddressIterator(void)
InterfaceAddressIterator 객체를 삭제합니다.

공개 함수

GetAddress(void)
현재 인터페이스 주소를 가져옵니다.
GetAddressWithPrefix(IPPrefix & addrWithPrefix)
void
현재 주소의 주소와 접두어 길이를 포함하는 IPPrefix를 반환합니다.
GetIPv6PrefixLength(void)
uint8_t
GetPrefixLength(void)에 대한 별칭이 지원 중단되었습니다.
GetInterface(void)
InterfaceId
GetInterfaceId(void)에 대한 별칭이 지원 중단되었습니다.
GetInterfaceId(void)
InterfaceId
현재 인터페이스 주소와 연결된 네트워크 인터페이스 ID를 반환합니다.
GetInterfaceName(char *nameBuf, size_t nameBufSize)
현재 인터페이스 주소와 연결된 네트워크 인터페이스의 이름을 가져옵니다.
GetPrefixLength(void)
uint8_t
현재 인터페이스 주소와 연결된 네트워크 프리픽스를 가져옵니다.
HasBroadcastAddress(void)
bool
현재 인터페이스 주소와 연결된 네트워크 인터페이스에 IPv4 브로드캐스트 주소가 있는지 반환합니다.
HasCurrent(void)
bool
IsUp(void)
bool
현재 인터페이스 주소와 연결된 네트워크 인터페이스가 작동 중인지 여부를 반환합니다.
Next(void)
bool
이터레이터를 다음 인터페이스 주소로 진행합니다.
SupportsMulticast(void)
bool
현재 인터페이스 주소와 연결된 네트워크 인터페이스에서 멀티캐스트를 지원하는지 여부를 반환합니다.

공개 함수

GetAddress

IPAddress GetAddress(
  void
)

현재 인터페이스 주소를 가져옵니다.

세부정보
반환
현재 인터페이스 주소 또는 IPAddress::Any(반복자가 주소 목록의 끝부분에 위치하는 경우)

GetAddressWithPrefix

void GetAddressWithPrefix(
  IPPrefix & addrWithPrefix
)

현재 주소의 주소와 접두어 길이를 포함하는 IPPrefix를 반환합니다.

GetIPv6PrefixLength

uint8_t GetIPv6PrefixLength(
  void
)

GetPrefixLength(void)에 대한 별칭이 지원 중단되었습니다.

GetInterface

InterfaceId GetInterface(
  void
)

GetInterfaceId(void)에 대한 별칭이 지원 중단되었습니다.

GetInterfaceId

InterfaceId GetInterfaceId(
  void
)

현재 인터페이스 주소와 연결된 네트워크 인터페이스 ID를 반환합니다.

세부정보
반환
인터페이스 ID 또는 INET_NULL_INTERFACEID(반복자가 주소 목록의 끝부분에 위치하는 경우)

GetInterfaceName

INET_ERROR GetInterfaceName(
  char *nameBuf,
  size_t nameBufSize
)

현재 인터페이스 주소와 연결된 네트워크 인터페이스의 이름을 가져옵니다.

Writes the name of the network interface as \c NUL terminated text string
at \c nameBuf.

세부정보
매개변수
[in] nameBuf
인터페이스 이름을 쓸 메모리 영역
[in] nameBufSize
nameBuf로 표시된 리전의 크기
반환 값
INET_NO_ERROR
성공적인 결과, 인터페이스 이름 작성됨
INET_ERROR_NO_MEMORY
이름이 너무 커서 버퍼에 작성할 수 없습니다.
INET_ERROR_INCORRECT_STATE
반복자가 현재 인터페이스 주소에 배치되어 있지 않습니다.
other
다른 시스템 또는 플랫폼 오류

GetPrefixLength

uint8_t GetPrefixLength(
  void
)

현재 인터페이스 주소와 연결된 네트워크 프리픽스를 가져옵니다.

On LwIP, this method simply returns the hard-coded constant 64.

Note Well: the standard subnet prefix on all links other than PPP
links is 64 bits. On PPP links and some non-broadcast multipoint access
links, the convention is either 127 bits or 128 bits, but it might be
something else. On most platforms, the system's interface address
structure can represent arbitrary prefix lengths between 0 and 128.

세부정보
반환
네트워크 접두어 (비트 단위) 또는 반복기가 주소 목록의 끝부분에 위치하는 경우 0입니다.

HasBroadcastAddress

bool HasBroadcastAddress(
  void
)

현재 인터페이스 주소와 연결된 네트워크 인터페이스에 IPv4 브로드캐스트 주소가 있는지 반환합니다.

세부정보
반환
인터페이스에 브로드캐스트 주소가 있는 경우 true, 존재하지 않는 경우 false, 인터페이스 주소에 반복기가 배치되지 않은 경우.

HasCurrents

bool HasCurrent(
  void
)

InterfaceAddressIterator

 InterfaceAddressIterator(
  void
)

InterfaceAddressIterator 객체를 생성합니다.

첫 번째 네트워크 주소에서 반복자를 시작합니다. 일부 플랫폼에서는 이 생성자가 소멸자에 의해 재활용된 리소스를 할당할 수 있습니다.

상승 중

bool IsUp(
  void
)

현재 인터페이스 주소와 연결된 네트워크 인터페이스가 작동 중인지 여부를 반환합니다.

세부정보
반환
현재 네트워크 인터페이스가 작동 중인 경우 true, 그렇지 않은 경우 false 또는 인터페이스 주소에 반복기가 배치되지 않은 경우

다음

bool Next(
  void
)

이터레이터를 다음 인터페이스 주소로 진행합니다.

Advances the iterator to the next interface address or to a position
beyond the end of the address list.

On LwIP, this method is thread-safe provided that: 1) other threads hold
the LwIP core lock while mutating the netif list; and 2) netif objects
themselves are never destroyed.  Additionally, iteration on LwIP systems
will terminate early if the current interface is removed from the list.

세부정보
반환
false 끝까지 진행해야 하는 경우, 그렇지 않으면 true입니다.

멀티캐스트 지원

bool SupportsMulticast(
  void
)

현재 인터페이스 주소와 연결된 네트워크 인터페이스에서 멀티캐스트를 지원하는지 여부를 반환합니다.

세부정보
반환
true 멀티캐스트가 지원되는 경우, false 지원되지 않는 경우 또는 이터레이터가 인터페이스 주소에 배치되지 않은 경우.

~InterfaceAddressIterator

 ~InterfaceAddressIterator(
  void
)

InterfaceAddressIterator 객체를 삭제합니다.

생성자가 할당한 모든 리소스를 재활용합니다.