Subversion Repositories HelenOS

Rev

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

Rev 4351 Rev 4505
Line 47... Line 47...
47
#include "../structures/module_map.h"
47
#include "../structures/module_map.h"
48
#include "../structures/packet/packet_server.h"
48
#include "../structures/packet/packet_server.h"
49
 
49
 
50
#include "../il/arp/arp_module.h"
50
#include "../il/arp/arp_module.h"
51
#include "../il/ip/ip_module.h"
51
#include "../il/ip/ip_module.h"
-
 
52
#include "../tl/udp/udp_module.h"
-
 
53
#include "../tl/tcp/tcp_module.h"
52
 
54
 
53
#include "net.h"
55
#include "net.h"
54
 
56
 
55
/** Networking module global data.
57
/** Networking module global data.
56
 */
58
 */
57
extern net_globals_t    net_globals;
59
extern net_globals_t    net_globals;
58
 
60
 
59
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
61
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ){
-
 
62
    if(( IPC_GET_METHOD( * call ) == IPC_M_CONNECT_TO_ME )
60
    if( IS_NET_IL_MESSAGE( call )){
63
    || IS_NET_IL_MESSAGE( call )){
61
        switch( IPC_GET_TARGET( call )){
64
        switch( IPC_GET_TARGET( call )){
62
            case SERVICE_IP:
65
            case SERVICE_IP:
63
                return ip_message( callid, call, answer, answer_count );
66
                return ip_message( callid, call, answer, answer_count );
64
            case SERVICE_ARP:
67
            case SERVICE_ARP:
65
                return arp_message( callid, call, answer, answer_count );
68
                return arp_message( callid, call, answer, answer_count );
66
            default:
69
            default:
67
                return EINVAL;
70
                return EINVAL;
68
        }
71
        }
-
 
72
    }else if( IS_NET_TL_MESSAGE( call )){
-
 
73
        switch( IPC_GET_TARGET( call )){
-
 
74
            case SERVICE_UDP:
-
 
75
                return udp_message( callid, call, answer, answer_count );
-
 
76
            case SERVICE_TCP:
-
 
77
                return tcp_message( callid, call, answer, answer_count );
-
 
78
            default:
-
 
79
                return EINVAL;
-
 
80
        }
69
    }else if( IS_NET_IP_MESSAGE( call ) || IS_NET_NIL_MESSAGE( call )){
81
    }else if( IS_NET_IP_MESSAGE( call ) || IS_NET_NIL_MESSAGE( call )){
70
        return ip_message( callid, call, answer, answer_count );
82
        return ip_message( callid, call, answer, answer_count );
71
    }else if( IS_NET_ARP_MESSAGE( call )){
83
    }else if( IS_NET_ARP_MESSAGE( call )){
72
        return arp_message( callid, call, answer, answer_count );
84
        return arp_message( callid, call, answer, answer_count );
73
/*  }else if( IS_NET_RARP_MESSAGE( call )){
85
/*  }else if( IS_NET_RARP_MESSAGE( call )){
74
        return rarp_message( callid, call, answer, answer_count );
86
        return rarp_message( callid, call, answer, answer_count );
75
    }else if( IS_NET_ICMP_MESSAGE( call )){
87
    }else if( IS_NET_ICMP_MESSAGE( call )){
76
        return icmp_message( callid, call, answer, answer_count );
88
        return icmp_message( callid, call, answer, answer_count );
77
    }else if( IS_NET_UDP_MESSAGE( call )){
89
*/  }else if( IS_NET_UDP_MESSAGE( call )){
78
        return udp_message( callid, call, answer, answer_count );
90
        return udp_message( callid, call, answer, answer_count );
79
    }else if( IS_NET_TCP_MESSAGE( call )){
91
    }else if( IS_NET_TCP_MESSAGE( call )){
80
        return tcp_message( callid, call, answer, answer_count );
92
        return tcp_message( callid, call, answer, answer_count );
81
    }else if( IS_NET_SOCKET_MESSAGE( call )){
93
/*  }else if( IS_NET_SOCKET_MESSAGE( call )){
82
        return socket_message( callid, call, answer, answer_count );
94
        return socket_message( callid, call, answer, answer_count );
83
*/  }else{
95
*/  }else{
84
        if( IS_NET_PACKET_MESSAGE( call )){
96
        if( IS_NET_PACKET_MESSAGE( call )){
85
            return packet_server_message( callid, call, answer, answer_count );
97
            return packet_server_message( callid, call, answer, answer_count );
86
        }else{
98
        }else{
Line 112... Line 124...
112
    ERROR_PROPAGATE( arp_initialize( client_connection ));
124
    ERROR_PROPAGATE( arp_initialize( client_connection ));
113
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_RARP, & phonehash ));
125
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_RARP, & phonehash ));
114
//  ERROR_PROPAGATE( rarp_initialize( client_connection ));
126
//  ERROR_PROPAGATE( rarp_initialize( client_connection ));
115
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
127
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_ICMP, & phonehash ));
116
//  ERROR_PROPAGATE( icmp_initialize( client_connection ));
128
//  ERROR_PROPAGATE( icmp_initialize( client_connection ));
117
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
129
    ERROR_PROPAGATE( REGISTER_ME( SERVICE_UDP, & phonehash ));
118
//  ERROR_PROPAGATE( udp_initialize( client_connection ));
130
    ERROR_PROPAGATE( udp_initialize( client_connection ));
119
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
131
    ERROR_PROPAGATE( REGISTER_ME( SERVICE_TCP, & phonehash ));
120
//  ERROR_PROPAGATE( tcp_initialize( client_connection ));
132
    ERROR_PROPAGATE( tcp_initialize( client_connection ));
121
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_SOCKET, & phonehash ));
133
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_SOCKET, & phonehash ));
122
//  ERROR_PROPAGATE( socket_initialize( client_connection ));
134
//  ERROR_PROPAGATE( socket_initialize( client_connection ));
123
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_ETHERNET, & phonehash ));
135
//  ERROR_PROPAGATE( REGISTER_ME( SERVICE_ETHERNET, & phonehash ));
124
//  ERROR_PROPAGATE( ethernet_initialize( client_connection ));
136
//  ERROR_PROPAGATE( ethernet_initialize( client_connection ));
125
    return EOK;
137
    return EOK;
Line 133... Line 145...
133
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
145
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
134
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
146
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
135
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
147
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
136
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
148
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
137
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
149
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
-
 
150
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
138
    }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
151
    }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
139
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
152
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
140
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
153
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
141
        // ethernet bundled in dp8390
154
        // ethernet bundled in dp8390
142
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", DP8390_NAME ));
155
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NIL", DP8390_NAME ));
Line 145... Line 158...
145
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" ));
158
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IRQ", "9" ));
146
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
159
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
147
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" ));
160
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "1492" ));
148
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
161
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
149
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
162
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
150
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.0" ));
163
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" ));
151
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
164
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
152
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
165
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
153
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
166
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
154
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
167
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
155
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
168
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));