Subversion Repositories HelenOS

Rev

Rev 3666 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3666 Rev 3846
Line 33... Line 33...
33
/** @file
33
/** @file
34
 */
34
 */
35
 
35
 
36
#include <async.h>
36
#include <async.h>
37
#include <stdio.h>
37
#include <stdio.h>
-
 
38
 
38
#include <ipc/ipc.h>
39
#include <ipc/ipc.h>
39
#include <ipc/services.h>
40
#include <ipc/services.h>
40
 
41
 
-
 
42
#include "../err.h"
41
#include "../modules.h"
43
#include "../modules.h"
42
 
44
 
-
 
45
#include "../include/protocols.h"
-
 
46
 
43
#include "tcp.h"
47
#include "tcp.h"
-
 
48
#include "tcp_module.h"
44
 
49
 
45
#define NAME    "TCP protocol"
50
#define NAME    "TCP protocol"
46
 
51
 
47
void    tcp_print_name( void );
52
void    tcp_print_name( void );
48
int tcp_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ));
53
int tcp_start_module( async_client_conn_t client_connection );
49
 
54
 
50
extern tcp_globals_t    tcp_globals;
55
extern tcp_globals_t    tcp_globals;
51
 
56
 
52
void tcp_print_name( void ){
57
void tcp_print_name( void ){
53
    printf( NAME );
58
    printf( NAME );
54
}
59
}
55
 
60
 
56
int tcp_start_module( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall )){
61
int tcp_start_module( async_client_conn_t client_connection ){
57
    services_t  need[ 3 ];
62
    ERROR_DECLARE;
-
 
63
 
58
    int *       need_phone[ 3 ];
64
    ipcarg_t    phonehash;
59
 
65
 
60
    need[ 0 ] = SERVICE_IP;
66
    async_set_client_connection( client_connection );
61
    need[ 1 ] = SERVICE_NETWORKING;
67
    tcp_globals.networking_phone = connect_to_service( SERVICE_NETWORKING );
62
    need[ 2 ] = NULL;
68
    tcp_globals.ip_phone = bind_service( SERVICE_IP, IPPROTO_TCP, 0, 0, client_connection );
63
    need_phone[ 0 ] = & tcp_globals.ip_phone;
69
    ERROR_PROPAGATE( tcp_initialize());
64
    need_phone[ 1 ] = & tcp_globals.networking_phone;
70
    ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
-
 
71
 
65
    need_phone[ 2 ] = NULL;
72
    async_manager();
-
 
73
 
66
    return start_service( SERVICE_TCP, need, need_phone, client_connection, tcp_initialize );
74
    return EOK;
67
}
75
}
68
 
76
 
69
/** @}
77
/** @}
70
 */
78
 */