/branches/network/uspace/srv/net/tl/tcp/tcp.c |
---|
44,7 → 44,7 |
#include "../../modules.h" |
#include "../../structures/packet/packet_client.h" |
#include "../../il/ip/ip_messages.h" |
#include "../../include/ip_interface.h" |
#include "tcp.h" |
#include "tcp_module.h" |
54,22 → 54,22 |
/** Initializes the module. |
*/ |
int tcp_initialize( void ){ |
ERROR_DECLARE; |
// ERROR_DECLARE; |
ipcarg_t arg1, arg2; |
// ipcarg_t arg1, arg2; |
packet_t packet; |
printf( "\nTCP - testing to send to IP:\t" ); |
/* printf( "TCP - testing to send to IP:\n" ); |
ERROR_PROPAGATE( ip_echo( tcp_globals.ip_phone, 12, 34, 0, 0, 0, & arg1, & arg2, NULL, NULL, NULL )); |
if(( arg1 != 12 ) || ( arg2 != 34 )) return EINVAL; |
printf( "OK\n" ); |
printf( "\nTCP - testing to send packet to IP:\t" ); |
packet = packet_get_4( tcp_globals.networking_phone, 6, 20, 30, 20 ); |
*/ |
printf( "TCP - testing to send packet to IP:\n" ); |
packet = packet_get_4( tcp_globals.net_phone, 6, 20, 30, 20 ); |
if( ! packet ) return ENOMEM; |
packet_copy_data( packet, "Hi, this is TCP", 16 ); |
ip_send( tcp_globals.ip_phone, -1, packet ); |
printf( "\tOK\n" ); |
ip_send_msg( tcp_globals.ip_phone, -1, packet, SERVICE_TCP ); |
printf( "OK\n" ); |
return EOK; |
} |
/branches/network/uspace/srv/net/tl/tcp/tcp.h |
---|
40,7 → 40,7 |
struct tcp_globals{ |
int ip_phone; |
int networking_phone; |
int net_phone; |
}; |
#endif |
/branches/network/uspace/srv/net/tl/tcp/tcp_module.c |
---|
44,7 → 44,9 |
#include "../../structures/packet/packet.h" |
#include "../../include/protocols.h" |
#include "../../include/net_interface.h" |
#include "../../include/ip_protocols.h" |
#include "../../include/ip_interface.h" |
#include "tcp.h" |
#include "tcp_module.h" |
51,23 → 53,24 |
#define NAME "TCP protocol" |
void tcp_print_name( void ); |
int tcp_start_module( async_client_conn_t client_connection ); |
void module_print_name( void ); |
int module_start( async_client_conn_t client_connection ); |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
extern tcp_globals_t tcp_globals; |
void tcp_print_name( void ){ |
void module_print_name( void ){ |
printf( "%s", NAME ); |
} |
int tcp_start_module( async_client_conn_t client_connection ){ |
int module_start( async_client_conn_t client_connection ){ |
ERROR_DECLARE; |
ipcarg_t phonehash; |
async_set_client_connection( client_connection ); |
tcp_globals.networking_phone = connect_to_service( SERVICE_NETWORKING ); |
tcp_globals.ip_phone = bind_service( SERVICE_IP, IPPROTO_TCP, 0, 0, client_connection ); |
tcp_globals.net_phone = net_connect_module( SERVICE_NETWORKING ); |
tcp_globals.ip_phone = ip_bind_service( SERVICE_IP, IPPROTO_TCP, client_connection ); |
ERROR_PROPAGATE( pm_init()); |
if( ERROR_OCCURRED( tcp_initialize()) |
|| ERROR_OCCURRED( REGISTER_ME( SERVICE_TCP, & phonehash ))){ |
81,5 → 84,9 |
return EOK; |
} |
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){ |
return tcp_message( callid, call, answer, answer_count ); |
} |
/** @} |
*/ |
/branches/network/uspace/srv/net/tl/tcp/Makefile |
---|
41,8 → 41,10 |
$(NET_BASE)module.c \ |
$(NET_BASE)modules.c \ |
$(STRUCTURES)packet/packet.c \ |
$(STRUCTURES)packet/packet_client.c |
$(STRUCTURES)packet/packet_client.c \ |
$(STRUCTURES)packet/packet_remote.c \ |
$(STRUCTURES)measured_strings.c \ |
$(NET_BASE)il/ip/ip_remote.c \ |
$(NET_BASE)net/net_remote.c |
NET_DEFS += -D TCP_BUNDLE=1 |
include $(NET_BASE)Makefile.module |