nl::Inet::UDPEndPoint

#include <src/inet/UDPEndPoint.h>

이 클래스의 객체는 UDP 전송 엔드포인트를 나타냅니다.

요약

시스템이 이에 따라 구성되므로 Nest Inet 레이어는 UDP 전송 엔드포인트 (Linux 및 BSD 파생 시스템의 SOCK_DGRAM 소켓) 또는 LwIP UDP 프로토콜 제어 블록과 상호작용하는 메서드를 캡슐화합니다.

상속

상속 대상: nl::Inet::IPEndPointBasis

공개 함수

Bind(IPAddressType addrType, IPAddress addr, uint16_t port, InterfaceId intfId)
엔드포인트를 인터페이스 IP 주소에 바인딩합니다.
BindInterface(IPAddressType addrType, InterfaceId intf)
엔드포인트를 네트워크 인터페이스에 바인딩합니다.
Close(void)
void
엔드포인트를 닫습니다.
Free(void)
void
엔드포인트를 닫고 메모리를 재활용합니다.
GetBoundInterface(void)
InterfaceId
이 엔드포인트에서 바인드된 인터페이스를 가져옵니다.
GetBoundPort(void)
uint16_t
Listen(void)
UDP 메시지를 수신할 엔드포인트를 준비합니다.
SendMsg(const IPPacketInfo *pktInfo, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
지정된 대상으로 UDP 메시지를 전송합니다.
SendTo(IPAddress addr, uint16_t port, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
SendTo(addr, port, INET_NULL_INTERFACEID, msg, sendFlags)의 동의어입니다.
SendTo(IPAddress addr, uint16_t port, InterfaceId intfId, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
지정된 대상 주소로 UDP 메시지를 보냅니다.

공개 함수

결합

INET_ERROR Bind(
  IPAddressType addrType,
  IPAddress addr,
  uint16_t port,
  InterfaceId intfId
)

엔드포인트를 인터페이스 IP 주소에 바인딩합니다.

엔드포인트를 지정된 네트워크 인터페이스 IP 주소에 바인딩합니다.

세부정보
매개변수
[in] addrType
IP 주소의 프로토콜 버전
[in] addr
IP 주소 (인터페이스 주소여야 함)
[in] port
UDP 포트
[in] intfId
네트워크 인터페이스 표시기(선택사항)
반환 값
INET_NO_ERROR
성공: 주소에 바인딩된 엔드포인트
INET_ERROR_INCORRECT_STATE
이전에 바인딩된 엔드포인트
INET_NO_MEMORY
엔드포인트를 위한 메모리 부족
INET_ERROR_UNKNOWN_INTERFACE
일부 플랫폼에는 선택적으로 지정된 인터페이스가 없습니다.
INET_ERROR_WRONG_PROTOCOL_TYPE
addrType이(가) IPVer과(와) 일치하지 않습니다.
INET_ERROR_WRONG_ADDRESS_TYPE
addrType이(가) kIPAddressType_Any이거나 addr의 유형이 addrType과(와) 같지 않습니다.
other
다른 시스템 또는 플랫폼 오류

LwIP에서는 이미 LwIP 스택 잠금이 설정된 상태에서는 이 메서드를 호출하면 안 됩니다.

BindInterface

INET_ERROR BindInterface(
  IPAddressType addrType,
  InterfaceId intf
)

엔드포인트를 네트워크 인터페이스에 바인딩합니다.

엔드포인트를 지정된 네트워크 인터페이스 IP 주소에 바인딩합니다.

세부정보
매개변수
[in] addrType
IP 주소의 프로토콜 버전입니다.
[in] intf
네트워크 인터페이스 표시기입니다.
반환 값
INET_NO_ERROR
성공: 주소에 바인딩된 엔드포인트
INET_NO_MEMORY
엔드포인트를 위한 메모리 부족
INET_ERROR_NOT_IMPLEMENTED
시스템 구현이 완료되지 않았습니다.
INET_ERROR_UNKNOWN_INTERFACE
일부 플랫폼에서는 인터페이스가 없습니다.
other
다른 시스템 또는 플랫폼 오류

LwIP에서는 이미 LwIP 스택 잠금이 설정된 상태에서는 이 메서드를 호출하면 안 됩니다.

닫기

void Close(
  void
)

엔드포인트를 닫습니다.

mState != kState_Closed인 경우 엔드포인트를 닫고 통신 이벤트에 적합한 엔드포인트 집합에서 삭제합니다.

LwIP 시스템에서는 이미 LwIP 스택 잠금이 설정된 상태에서 이 메서드를 호출하면 안 됩니다.

무료

void Free(
  void
)

엔드포인트를 닫고 메모리를 재활용합니다.

Close 메서드를 호출한 다음 InetLayerBasis::Release 메서드를 호출하여 객체를 메모리 풀에 반환합니다.

LwIP 시스템에서는 이미 LwIP 스택 잠금이 설정된 상태에서 이 메서드를 호출하면 안 됩니다.

GetBoundInterface

InterfaceId GetBoundInterface(
  void
)

이 엔드포인트에서 바인드된 인터페이스를 가져옵니다.

세부정보
반환
InterfaceId 바인딩된 인터페이스 ID입니다.

GetBoundPort

uint16_t GetBoundPort(
  void
)

수신 대기

INET_ERROR Listen(
  void
)

UDP 메시지를 수신할 엔드포인트를 준비합니다.

State가 이미 kState_Listening이면 작업이 수행되지 않습니다. 그렇지 않으면 mStatekState_Listening로 설정되고 엔드포인트는 플랫폼의 시맨틱에 따라 UDP 메시지를 수신할 준비가 됩니다.

세부정보
반환 값
INET_NO_ERROR
성공: 엔드포인트에서 메시지를 수신할 준비가 되었습니다.
INET_ERROR_INCORRECT_STATE
엔드포인트가 이미 수신 대기 중입니다.

LwIP에서는 이미 LwIP 스택 잠금이 설정된 상태에서 이 메서드를 호출하면 안 됩니다.

SendMsg

INET_ERROR SendMsg(
  const IPPacketInfo *pktInfo,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

지정된 대상으로 UDP 메시지를 전송합니다.

 Send the UDP message in \c msg to the destination address and port given in
 \c pktInfo.  If \c pktInfo contains an interface id, the message will be sent
 over the specified interface.  If \c pktInfo contains a source address, the
 given address will be used as the source of the UDP message.

 Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls
 Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this
 method deep-copies \c msg into a fresh object, and queues that for
 transmission, leaving the original \c msg available after return.

세부정보
매개변수
[in] pktInfo
UDP 메시지의 소스 및 대상 정보
[in] msg
UDP 메시지가 포함된 패킷 버퍼
[in] sendFlags
선택적 전송 옵션 플래그
반환 값
INET_NO_ERROR
성공: msg가 전송 대기열에 추가됩니다.
INET_ERROR_NOT_SUPPORTED
시스템에서 요청된 작업을 지원하지 않는 경우
INET_ERROR_WRONG_ADDRESS_TYPE
대상 주소와 바인드된 인터페이스 주소에 일치하는 프로토콜 버전 또는 주소 유형이 없을 때.
INET_ERROR_MESSAGE_TOO_LONG
msg에 전체 UDP 메시지가 포함되지 않습니다.
INET_ERROR_OUTBOUND_MESSAGE_TRUNCATED
일부 플랫폼에서는 msg의 잘린 부분만 전송 대기열에 추가되었습니다.
other
다른 시스템 또는 플랫폼 오류

SendTo

INET_ERROR SendTo(
  IPAddress addr,
  uint16_t port,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

SendTo(addr, port, INET_NULL_INTERFACEID, msg, sendFlags)의 동의어입니다.

SendTo

INET_ERROR SendTo(
  IPAddress addr,
  uint16_t port,
  InterfaceId intfId,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

지정된 대상 주소로 UDP 메시지를 보냅니다.

 If possible, then this method sends the UDP message \c msg to the
 destination \c addr (with \c intfId used as the scope
 identifier for IPv6 link-local destinations) and \c port with the
 transmit option flags encoded in \c sendFlags.

 Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls
 Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this
 method deep-copies \c msg into a fresh object, and queues that for
 transmission, leaving the original \c msg available after return.

세부정보
매개변수
[in] addr
대상 IP 주소
[in] port
목적지 UDP 포트
[in] intfId
네트워크 인터페이스 표시기(선택사항)
[in] msg
UDP 메시지가 포함된 패킷 버퍼
[in] sendFlags
선택적 전송 옵션 플래그
반환 값
INET_NO_ERROR
성공: msg가 전송 대기열에 추가됩니다.
INET_ERROR_NOT_SUPPORTED
시스템에서 요청된 작업을 지원하지 않는 경우
INET_ERROR_WRONG_ADDRESS_TYPE
대상 주소와 바인드된 인터페이스 주소에 일치하는 프로토콜 버전 또는 주소 유형이 없을 때.
INET_ERROR_MESSAGE_TOO_LONG
msg에 전체 UDP 메시지가 포함되지 않습니다.
INET_ERROR_OUTBOUND_MESSAGE_TRUNCATED
일부 플랫폼에서는 msg의 잘린 부분만 전송 대기열에 추가되었습니다.
other
다른 시스템 또는 플랫폼 오류