Data Structures | |
| struct | s_PXENV_UDP_READ |
| Parameter block for pxenv_udp_read(). More... | |
Defines | |
| #define | PXENV_UDP_READ 0x0032 |
| PXE API function code for pxenv_udp_read(). | |
Typedefs | |
| typedef struct s_PXENV_UDP_READ | PXENV_UDP_READ_t |
Functions | |
| PXENV_EXIT_t | pxenv_udp_read (struct s_PXENV_UDP_READ *udp_read) |
| UDP READ. | |
| #define PXENV_UDP_READ 0x0032 |
PXE API function code for pxenv_udp_read().
Definition at line 811 of file pxe_api.h.
Referenced by pxe_api_call().
| typedef struct s_PXENV_UDP_READ PXENV_UDP_READ_t |
| PXENV_EXIT_t pxenv_udp_read | ( | struct s_PXENV_UDP_READ * | pxenv_udp_read | ) |
UDP READ.
| pxenv_udp_read | Pointer to a struct s_PXENV_UDP_READ | |
| s_PXENV_UDP_READ::dest_ip | Destination IP address, or 0.0.0.0 | |
| s_PXENV_UDP_READ::d_port | Destination UDP port, or 0 | |
| s_PXENV_UDP_READ::buffer_size | Size of the UDP payload buffer | |
| s_PXENV_UDP_READ::buffer | Address of the UDP payload buffer |
| PXENV_EXIT_SUCCESS | A packet has been received | |
| PXENV_EXIT_FAILURE | No packet has been received | |
| s_PXENV_UDP_READ::Status | PXE status code | |
| s_PXENV_UDP_READ::src_ip | Source IP address | |
| s_PXENV_UDP_READ::dest_ip | Destination IP address | |
| s_PXENV_UDP_READ::s_port | Source UDP port | |
| s_PXENV_UDP_READ::d_port | Destination UDP port | |
| s_PXENV_UDP_READ::buffer_size | Length of UDP payload |
| PXENV_STATUS_UDP_CLOSED | UDP connection is not open | |
| PXENV_STATUS_FAILURE | No packet was ready to read |
If s_PXENV_UDP_READ::dest_ip is 0.0.0.0, UDP packets addressed to any IP address will be accepted and may be returned to the caller.
If s_PXENV_UDP_READ::d_port is 0, UDP packets addressed to any UDP port will be accepted and may be returned to the caller.
You must have opened a UDP connection with pxenv_udp_open() before calling pxenv_udp_read().
On x86, you must set the s_PXE::StatusCallout field to a nonzero value before calling this function in protected mode. You cannot call this function with a 32-bit stack segment. (See the relevant implementation note for more details.)
Definition at line 360 of file pxe_udp.c.
References s_PXENV_UDP_READ::buffer, s_PXENV_UDP_READ::buffer_size, s_PXENV_UDP_READ::d_port, DBG, s_PXENV_UDP_READ::dest_ip, htons, inet_ntoa(), ntohs, NULL, s_SEGOFF16::offset, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_FAILURE, PXENV_STATUS_SUCCESS, pxe_udp_connection::pxenv_udp_read, in_addr::s_addr, s_PXENV_UDP_READ::s_port, s_SEGOFF16::segment, s_PXENV_UDP_READ::src_ip, s_PXENV_UDP_READ::Status, and step().
Referenced by pxe_api_call(), and pxe_udp_deliver_iob().
00360 { 00361 struct in_addr dest_ip_wanted = { .s_addr = pxenv_udp_read->dest_ip }; 00362 struct in_addr dest_ip; 00363 uint16_t d_port_wanted = pxenv_udp_read->d_port; 00364 uint16_t d_port; 00365 00366 DBG ( "PXENV_UDP_READ" ); 00367 00368 /* Try receiving a packet */ 00369 pxe_udp.pxenv_udp_read = pxenv_udp_read; 00370 step(); 00371 if ( pxe_udp.pxenv_udp_read ) { 00372 /* No packet received */ 00373 pxe_udp.pxenv_udp_read = NULL; 00374 goto no_packet; 00375 } 00376 dest_ip.s_addr = pxenv_udp_read->dest_ip; 00377 d_port = pxenv_udp_read->d_port; 00378 00379 /* Filter on destination address and/or port */ 00380 if ( dest_ip_wanted.s_addr && 00381 ( dest_ip_wanted.s_addr != dest_ip.s_addr ) ) { 00382 DBG ( " wrong IP %s", inet_ntoa ( dest_ip ) ); 00383 DBG ( " (wanted %s)", inet_ntoa ( dest_ip_wanted ) ); 00384 goto no_packet; 00385 } 00386 if ( d_port_wanted && ( d_port_wanted != d_port ) ) { 00387 DBG ( " wrong port %d ", htons ( d_port ) ); 00388 DBG ( " (wanted %d)", htons ( d_port_wanted ) ); 00389 goto no_packet; 00390 } 00391 00392 DBG ( " %04x:%04x+%x %s:", pxenv_udp_read->buffer.segment, 00393 pxenv_udp_read->buffer.offset, pxenv_udp_read->buffer_size, 00394 inet_ntoa ( *( ( struct in_addr * ) &pxenv_udp_read->src_ip ) )); 00395 DBG ( "%d<-%s:%d", ntohs ( pxenv_udp_read->s_port ), 00396 inet_ntoa ( *( ( struct in_addr * ) &pxenv_udp_read->dest_ip ) ), 00397 ntohs ( pxenv_udp_read->d_port ) ); 00398 00399 pxenv_udp_read->Status = PXENV_STATUS_SUCCESS; 00400 return PXENV_EXIT_SUCCESS; 00401 00402 no_packet: 00403 pxenv_udp_read->Status = PXENV_STATUS_FAILURE; 00404 return PXENV_EXIT_FAILURE; 00405 }
1.5.7.1