Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4557 → Rev 4558

/branches/network/uspace/srv/net/il/arp/arp.c
236,6 → 236,7
arp_device_ref device;
arp_proto_ref proto;
int index;
hw_type_t hardware;
 
rwlock_write_lock( & arp_globals.lock );
// an existing device?
266,8 → 267,8
printf( "New protocol added:\n\tdevice id\t= %d\n\tproto\t= %d", device_id, protocol );
}
}else{
index = hardware_map( service );
if( ! index ) return ENOENT;
hardware = hardware_map( service );
if( ! hardware ) return ENOENT;
// create a new device
device = ( arp_device_ref ) malloc( sizeof( arp_device_t ));
if( ! device ){
274,7 → 275,7
rwlock_write_unlock( & arp_globals.lock );
return ENOMEM;
}
device->hardware = index;
device->hardware = hardware;
device->device_id = device_id;
if( ERROR_OCCURRED( arp_protos_initialize( & device->protos ))
|| ERROR_OCCURRED( arp_proto_create( & proto, protocol, address ))){
291,7 → 292,7
}
device->service = service;
// bind the new one
device->phone = bind_service( device->service, device->device_id, SERVICE_ARP, 0, arp_globals.client_connection );
device->phone = bind_service( device->service, ( ipcarg_t ) device->device_id, SERVICE_ARP, 0, arp_globals.client_connection );
if( device->phone < 0 ){
rwlock_write_unlock( & arp_globals.lock );
arp_protos_destroy( & device->protos );
363,9 → 364,9
return NULL;
}
header->hardware = htons( device->hardware );
header->hardware_length = device->addr->length;
header->hardware_length = ( uint8_t ) device->addr->length;
header->protocol = htons( protocol_map( device->service, protocol ));
header->protocol_length = proto->addr->length;
header->protocol_length = ( uint8_t ) proto->addr->length;
header->operation = htons( ARPOP_REQUEST );
length = sizeof( arp_header_t );
memcpy((( uint8_t * ) header ) + length, device->addr->value, device->addr->length );
402,7 → 403,8
if( ! device ) return ENOENT;
header = ( arp_header_ref ) packet_get_data( packet );
if(( ntohs( header->hardware ) != device->hardware )
|| ( length < sizeof( arp_header_t ) + ( header->hardware_length + header->protocol_length ) * 2 )){
// TODO how remove conversion from int '2' to uint?
|| ( length < sizeof( arp_header_t ) + ( header->hardware_length + header->protocol_length ) * 2u )){
return EINVAL;
}
proto = arp_protos_find( & device->protos, protocol_unmap( device->service, ntohs( header->protocol )));
/branches/network/uspace/srv/net/il/arp/arp.h
43,6 → 43,7
#include <ipc/services.h>
 
#include "../../include/device.h"
#include "../../include/hardware.h"
 
#include "../../structures/generic_char_map.h"
#include "../../structures/int_map.h"
100,7 → 101,7
device_id_t device_id;
/** Hardware type.
*/
ipcarg_t hardware;
hw_type_t hardware;
/** Reserved packet prefix length.
*/
size_t prefix;
/branches/network/uspace/srv/net/il/arp/arp_remote.c
55,10 → 55,10
aid_t message_id;
ipcarg_t result;
 
message_id = async_send_3( arp_phone, NET_ARP_DEVICE, device_id, protocol, netif, NULL );
message_id = async_send_3( arp_phone, NET_ARP_DEVICE, ( ipcarg_t ) device_id, protocol, netif, NULL );
measured_strings_send( arp_phone, address, 1 );
async_wait_for( message_id, & result );
return result;
return ( int ) result;
}
 
int arp_translate_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data ){
66,11 → 66,11
}
 
int arp_clear_device_req( int arp_phone, device_id_t device_id ){
return async_req_1_0( arp_phone, NET_ARP_CLEAR_DEVICE, device_id );
return ( int ) async_req_1_0( arp_phone, NET_ARP_CLEAR_DEVICE, ( ipcarg_t ) device_id );
}
 
int arp_clean_cache_req( int arp_phone ){
return async_req_0_0( arp_phone, NET_ARP_CLEAN_CACHE );
return ( int ) async_req_0_0( arp_phone, NET_ARP_CLEAN_CACHE );
}
 
int arp_connect_module( services_t service ){