Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensocket.c
Go to the documentation of this file.
00001 #include "rosdhcp.h" 00002 00003 SOCKET ServerSocket; 00004 00005 void SocketInit() { 00006 ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 ); 00007 } 00008 00009 ssize_t send_packet( struct interface_info *ip, 00010 struct dhcp_packet *p, 00011 size_t size, 00012 struct in_addr addr, 00013 struct sockaddr_in *broadcast, 00014 struct hardware *hardware ) { 00015 int result = 00016 sendto( ip->wfdesc, (char *)p, size, 0, 00017 (struct sockaddr *)broadcast, sizeof(*broadcast) ); 00018 00019 if (result < 0) { 00020 note ("send_packet: %x", result); 00021 if (result == WSAENETUNREACH) 00022 note ("send_packet: please consult README file%s", 00023 " regarding broadcast address."); 00024 } 00025 00026 return result; 00027 } 00028 00029 ssize_t receive_packet(struct interface_info *ip, 00030 unsigned char *packet_data, 00031 size_t packet_len, 00032 struct sockaddr_in *dest, 00033 struct hardware *hardware ) { 00034 int recv_addr_size = sizeof(*dest); 00035 int result = 00036 recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0, 00037 (struct sockaddr *)dest, &recv_addr_size ); 00038 return result; 00039 } Generated on Sat May 26 2012 04:22:03 for ReactOS by
1.7.6.1
|