Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3900 → Rev 3901

/branches/network/uspace/srv/net/il/ip/ip.c
49,7 → 49,7
#include "../../include/socket.h"
#include "../../netif/device.h"
#include "../../structures/measured_strings.h"
#include "../../structures/packet/packet.h"
#include "../../structures/packet/packet_client.h"
 
#include "ip.h"
#include "ip_messages.h"
58,6 → 58,7
#define DEFAULT_IPV 4
 
#define IPC_GET_DEVICE( call ) ( device_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PACKET( call ) ( packet_id_t ) IPC_GET_ARG1( * call )
#define IPC_GET_PROTO( call ) ( int ) IPC_GET_ARG1( * call )
#define IPC_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG2( * call )
#define IPC_GET_STATE( call ) ( device_state_t ) IPC_GET_ARG2( * call )
213,12 → 214,9
// TODO packer received
case NET_IL_RECEIVED:
case NET_NIL_RECEIVED:
if( ERROR_OCCURED( result = packet_receive( & packet ))){
ipc_answer_0( callid, ERROR_CODE );
continue;
if( ! ERROR_OCCURED( result = packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( & call )))){
//result = ip_receive_message( IPC_GET_DEVICE( call ), packet );
}
//result = ip_receive_message( IPC_GET_DEVICE( call ), packet );
packet_destroy( packet );
ipc_answer_0( callid, result );
}
}
249,6 → 247,7
int ip_send_message( device_id_t device_id, packet_t packet ){
// TODO send packet
printf( "Packet to send via %d: %s", device_id, packet_get_data( packet ));
packet_release( ip_globals.networking_phone, packet_get_id( packet ));
return EOK;
}
 
269,7 → 268,10
case IPC_M_CONNECT_TO_ME:
return ip_register_message( IPC_GET_PROTO( call ), IPC_GET_PHONE( call ));
case NET_IP_SEND:
ERROR_PROPAGATE( packet_receive( & packet ));
if( ERROR_OCCURED( packet_translate( ip_globals.networking_phone, & packet, IPC_GET_PACKET( call )))){
printf( "\nIP send E %d", ERROR_CODE );
return ERROR_CODE;
}
return ip_send_message( IPC_GET_DEVICE( call ), packet );
}
return ENOTSUP;