ReactOS 0.4.16-dev-136-g52192f1
socket.c File Reference
#include <rosdhcp.h>
Include dependency graph for socket.c:

Go to the source code of this file.

Functions

void SocketInit ()
 
ssize_t send_packet (struct interface_info *ip, struct dhcp_packet *p, size_t size, struct in_addr addr, struct sockaddr_in *broadcast, struct hardware *hardware)
 
ssize_t receive_packet (struct interface_info *ip, unsigned char *packet_data, size_t packet_len, struct sockaddr_in *dest, struct hardware *hardware)
 

Variables

SOCKET ServerSocket
 

Function Documentation

◆ receive_packet()

ssize_t receive_packet ( struct interface_info ip,
unsigned char packet_data,
size_t  packet_len,
struct sockaddr_in dest,
struct hardware hardware 
)

Definition at line 34 of file socket.c.

38 {
39 int recv_addr_size = sizeof(*dest);
40 int result;
41
42 if (packet_len > INT_MAX)
43 return WSAEMSGSIZE;
44
45 result =
46 recvfrom (ip -> rfdesc, (char *)packet_data, (int)packet_len, 0,
47 (struct sockaddr *)dest, &recv_addr_size );
48 return result;
49}
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
Definition: recv.c:87
GLuint64EXT * result
Definition: glext.h:11304
#define INT_MAX
Definition: limits.h:40
static char * dest
Definition: rtl.c:135
Definition: dhcpd.h:62
#define WSAEMSGSIZE
Definition: winerror.h:1953

Referenced by got_one().

◆ send_packet()

ssize_t send_packet ( struct interface_info ip,
struct dhcp_packet p,
size_t  size,
struct in_addr  addr,
struct sockaddr_in broadcast,
struct hardware hardware 
)

Definition at line 9 of file socket.c.

14 {
15 int result;
16
17 if (size > INT_MAX)
18 return WSAEMSGSIZE;
19
20 result =
21 sendto( ip->wfdesc, (char *)p, (int)size, 0,
22 (struct sockaddr *)broadcast, sizeof(*broadcast) );
23
24 if (result < 0) {
25 note ("send_packet: %x", result);
27 note ("send_packet: please consult README file%s",
28 " regarding broadcast address.");
29 }
30
31 return result;
32}
int note(char *format,...)
Definition: util.c:12
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
Definition: send.c:82
GLsizeiptr size
Definition: glext.h:5919
GLfloat GLfloat p
Definition: glext.h:8902
#define WSAENETUNREACH
Definition: winerror.h:1964

Referenced by send_decline(), send_discover(), and send_request().

◆ SocketInit()

void SocketInit ( )

Definition at line 5 of file socket.c.

5 {
7}
#define AF_INET
Definition: tcpip.h:117
SOCKET ServerSocket
Definition: socket.c:3
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
#define SOCK_DGRAM
Definition: winsock.h:336

Variable Documentation

◆ ServerSocket

SOCKET ServerSocket

Definition at line 3 of file socket.c.

Referenced by SocketInit(), START_TEST(), and Test_Overread().