127,6 → 127,13 |
*/ |
void clear_device( arp_device_ref device ); |
|
/** Updates the device content length according to the new MTU value. |
* @param device_id The device identifier. Input parameter. |
* @param mtu The new mtu value. Input parameter. |
* @returns EOK on success. |
*/ |
int arp_mtu_changed_msg( device_id_t device_id, size_t mtu ); |
|
DEVICE_MAP_IMPLEMENT( arp_cache, arp_device_t ) |
|
INT_MAP_IMPLEMENT( arp_protos, arp_proto_t ) |
152,6 → 159,26 |
return EOK; |
} |
|
int arp_clear_address_req( int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address ){ |
arp_device_ref device; |
arp_proto_ref proto; |
|
fibril_rwlock_write_lock( & arp_globals.lock ); |
device = arp_cache_find( & arp_globals.cache, device_id ); |
if( ! device ){ |
fibril_rwlock_write_unlock( & arp_globals.lock ); |
return ENOENT; |
} |
proto = arp_protos_find( & device->protos, protocol ); |
if( ! proto ){ |
fibril_rwlock_write_unlock( & arp_globals.lock ); |
return ENOENT; |
} |
arp_addr_exclude( & proto->addresses, address->value, address->length ); |
fibril_rwlock_write_unlock( & arp_globals.lock ); |
return EOK; |
} |
|
int arp_clean_cache_req( int arp_phone ){ |
int count; |
arp_device_ref device; |
465,6 → 492,21 |
return EOK; |
} |
|
int arp_mtu_changed_msg( device_id_t device_id, size_t mtu ){ |
arp_device_ref device; |
|
fibril_rwlock_write_lock( & arp_globals.lock ); |
device = arp_cache_find( & arp_globals.cache, device_id ); |
if( ! device ){ |
fibril_rwlock_write_unlock( & arp_globals.lock ); |
return ENOENT; |
} |
device->content = mtu; |
printf( "arp - device %d changed mtu to %d\n\n", device_id, mtu ); |
fibril_rwlock_write_unlock( & arp_globals.lock ); |
return EOK; |
} |
|
int arp_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
ERROR_DECLARE; |
|
501,6 → 543,12 |
return ERROR_CODE; |
case NET_ARP_CLEAR_DEVICE: |
return arp_clear_device_req( 0, IPC_GET_DEVICE( call )); |
case NET_ARP_CLEAR_ADDRESS: |
ERROR_PROPAGATE( measured_strings_receive( & address, & data, 1 )); |
arp_clear_address_req( 0, IPC_GET_DEVICE( call ), IPC_GET_SERVICE( call ), address ); |
free( address ); |
free( data ); |
return EOK; |
case NET_ARP_CLEAN_CACHE: |
return arp_clean_cache_req( 0 ); |
case NET_IL_DEVICE_STATE: |
518,6 → 566,8 |
fibril_rwlock_read_unlock( & arp_globals.lock ); |
} |
return ERROR_CODE; |
case NET_IL_MTU_CHANGED: |
return arp_mtu_changed_msg( IPC_GET_DEVICE( call ), IPC_GET_MTU( call )); |
} |
return ENOTSUP; |
} |