UDP (User Datagram Protocol)
More...
|
virtual void | UDPDatagramListener::handleDatagram (IPv6Interface &input, const IPv6Address *src_addr, const IPv6Address *dst_addr, uint16_t src_port, uint16_t dst_port, const uint8_t *msg, uint16_t len)=0 |
| 수신된 UDP datagram을 처리합니다.
|
|
error_t | UDP::sendto (IPv6Interface *output, const IPv6Address *src_addr, uint16_t src_port, const IPv6Address *dst_addr, uint16_t dst_port, const void *user_data, uint16_t len) |
|
error_t | UDP::listen (uint16_t port, void(*func)(IPv6Interface &input, const IPv6Address *src_addr, const IPv6Address *dst_addr, uint16_t src_port, uint16_t dst_port, const uint8_t *msg, uint16_t len)) |
|
error_t | UDP::listen (uint16_t port, UDPDatagramListener *listener) |
| UDP 포트를 열고, 수신되는 UDP datagram들을 객체로 전달합니다. More...
|
|
error_t | UDP::stopListening (uint16_t port) |
| UDP 포트를 닫습니다. More...
|
|
uint16_t | UDP::getUnusedRandomPort () |
| Get a random port number that is not listening.
|
|
static void | UDP::receive (IPv6Interface &input, IPv6PacketBuffer *head, IPv6PacketBuffer *ippkt, IPv6PacketBuffer *udppkt) |
|
|
uint16_t | UDP::Header_t::src_port |
|
uint16_t | UDP::Header_t::dst_port |
|
uint16_t | UDP::Header_t::length |
|
uint16_t | UDP::Header_t::checksum |
|
UDP | Udp |
|
UDP (User Datagram Protocol)
◆ listen() [1/2]
UDP 포트를 열고, 수신되는 UDP datagram들을 객체로 전달합니다.
- Parameters
-
[in] | port | Port number |
[in] | listener | UDP datagram을 처리 가능한 객체의 포인터. |
◆ listen() [2/2]
error_t UDP::listen |
( |
uint16_t |
port, |
|
|
void(*)(IPv6Interface &input, const IPv6Address *src_addr, const IPv6Address *dst_addr, uint16_t src_port, uint16_t dst_port, const uint8_t *msg, uint16_t len) |
func |
|
) |
| |
Open an UDP port to listen incoming UDP datagrams.
- Parameters
-
[in] | port | Port number |
[in] | func | Callback function to be called on receipt of UDP datagrams |
- Returns
- ERROR_SUCCESS: Opening the UDP port is successful.
- ERROR_BUSY: There is already opened port with number of
port
. Or opening the port is denied by the system due to out of resource.
- ERROR_NOT_ENOUGH_MEMORY: Opening the port is failed due to out of memory.
- ERROR_INVALID_ARGS:
func
is NULL.
◆ sendto()
error_t UDP::sendto |
( |
IPv6Interface * |
output, |
|
|
const IPv6Address * |
src_addr, |
|
|
uint16_t |
src_port, |
|
|
const IPv6Address * |
dst_addr, |
|
|
uint16_t |
dst_port, |
|
|
const void * |
user_data, |
|
|
uint16_t |
len |
|
) |
| |
Send a user datagram.
- Parameters
-
[in] | out_inf | Output interface ID (only for link-local send) |
[in] | src_addr | Source IPv6 address. If it is NULL, most preferred address is selected. |
[in] | src_port | Source port address. |
[in] | dst_addr | Destination IPv6 address. |
[in] | dst_port | Destination port address. |
[in] | buf | The User datagram to be sent. |
[in] | len | The Length of buf. |
- Returns
- An error code.
◆ stopListening()
error_t UDP::stopListening |
( |
uint16_t |
port | ) |
|
UDP 포트를 닫습니다.
- Parameters
-
- Returns
- ERROR_SUCCESS: 성공
- ERROR_FAIL:
port
가 현재 수신 대기 중이 아니므로 실패