Adapter: some info display.

Socket: implemented send and recv.

svn path=/trunk/; revision=14544
This commit is contained in:
Art Yerkes 2005-04-08 11:08:26 +00:00
parent c0282425ac
commit d57bccaddf
2 changed files with 21 additions and 3 deletions

View file

@ -91,7 +91,9 @@ void AdapterInit() {
Adapter->DhclientConfig.retry_interval;
strncpy(Adapter->DhclientInfo.name, Adapter->IfMib.bDescr,
sizeof(Adapter->DhclientInfo.name));
DH_DbgPrint(MID_TRACE,("Adapter Name: [%s]\n", Adapter->DhclientInfo.name));
DH_DbgPrint(MID_TRACE,("Adapter Name: [%s] (Bind Status %x)\n",
Adapter->DhclientInfo.name,
Adapter->BindStatus));
ifi = &Adapter->DhclientInfo;
}
}
@ -156,6 +158,7 @@ PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This )
}
void if_register_send(struct interface_info *ip) {
}
void if_register_receive(struct interface_info *ip) {

View file

@ -12,7 +12,18 @@ ssize_t send_packet( struct interface_info *ip,
struct in_addr addr,
struct sockaddr_in *broadcast,
struct hardware *hardware ) {
return 0;
int result =
sendto( ip->wfdesc, (char *)p, size, 0,
(struct sockaddr *)broadcast, sizeof(*broadcast) );
if (result < 0) {
note ("send_packet: %x", result);
if (result == WSAENETUNREACH)
note ("send_packet: please consult README file%s",
" regarding broadcast address.");
}
return result;
}
ssize_t receive_packet(struct interface_info *ip,
@ -20,5 +31,9 @@ ssize_t receive_packet(struct interface_info *ip,
size_t packet_len,
struct sockaddr_in *dest,
struct hardware *hardware ) {
return 0;
int recv_addr_size = sizeof(*dest);
int result =
recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0,
(struct sockaddr *)dest, &recv_addr_size );
return result;
}