ReactOS  0.4.12-dev-14-gd0c8636
socket.c
Go to the documentation of this file.
1 #include <rosdhcp.h>
2 
4 
5 void SocketInit() {
7 }
8 
10  struct dhcp_packet *p,
11  size_t size,
12  struct in_addr addr,
13  struct sockaddr_in *broadcast,
14  struct hardware *hardware ) {
15  int result =
16  sendto( ip->wfdesc, (char *)p, size, 0,
17  (struct sockaddr *)broadcast, sizeof(*broadcast) );
18 
19  if (result < 0) {
20  note ("send_packet: %x", result);
21  if (result == WSAENETUNREACH)
22  note ("send_packet: please consult README file%s",
23  " regarding broadcast address.");
24  }
25 
26  return result;
27 }
28 
30  unsigned char *packet_data,
31  size_t packet_len,
32  struct sockaddr_in *dest,
33  struct hardware *hardware ) {
34  int recv_addr_size = sizeof(*dest);
35  int result =
36  recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0,
37  (struct sockaddr *)dest, &recv_addr_size );
38  return result;
39 }
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
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
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: socket.c:9
int wfdesc
Definition: dhcpd.h:233
int note(char *format,...)
Definition: util.c:12
GLsizeiptr size
Definition: glext.h:5919
Definition: dhcpd.h:61
Definition: tcpip.h:125
GLfloat CONST GLvector4f CONST GLfloat GLvector4f * dest
Definition: m_xform.h:122
GLenum const GLvoid * addr
Definition: glext.h:9621
#define WSAENETUNREACH
Definition: winerror.h:1964
int ssize_t
Definition: rosdhcp.h:48
ssize_t receive_packet(struct interface_info *ip, unsigned char *packet_data, size_t packet_len, struct sockaddr_in *dest, struct hardware *hardware)
Definition: socket.c:29
SOCKET ServerSocket
Definition: socket.c:3
void SocketInit()
Definition: socket.c:5
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
#define AF_INET
Definition: tcpip.h:117
UINT_PTR SOCKET
Definition: winsock.h:47
GLfloat GLfloat p
Definition: glext.h:8902
#define SOCK_DGRAM
Definition: winsock.h:336
GLuint64EXT * result
Definition: glext.h:11304