Rev 3991 | Rev 4192 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3991 | Rev 4163 | ||
---|---|---|---|
Line 140... | Line 140... | ||
140 | return ENOTSUP; |
140 | return ENOTSUP; |
141 | } |
141 | } |
142 | // TODO ARP module |
142 | // TODO ARP module |
143 | } |
143 | } |
144 | // TODO arp module |
144 | // TODO arp module |
- | 145 | // TODO register |
|
145 | free( settings ); |
146 | free( settings ); |
146 | free( data ); |
147 | free( data ); |
147 | // end request |
148 | // end request |
148 | // TODO mapping |
149 | // TODO mapping |
149 | async_wait_for( message, NULL ); |
150 | async_wait_for( message, NULL ); |
150 | // print the settings |
151 | // print the settings |
151 | printf( "\n -IPV =\t%d", ip_netif->ipv ); |
152 | printf( "\nNew device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d", ip_netif->device_id, ip_netif->phone, ip_netif->ipv ); |
152 | printf( "\n -configuration =\t%s", ip_netif->dhcp ? "dhcp" : "static" ); |
153 | printf( "\n\tconfiguration\t= %s", ip_netif->dhcp ? "dhcp" : "static" ); |
153 | // TODO ipv6 |
154 | // TODO ipv6 |
154 | data = malloc( INET_ADDRSTRLEN ); |
155 | data = malloc( INET_ADDRSTRLEN ); |
155 | if( data ){ |
156 | if( data ){ |
156 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->address, data, INET_ADDRSTRLEN ); |
157 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->address, data, INET_ADDRSTRLEN ); |
157 | printf( "\n -address =\t%s", data ); |
158 | printf( "\n\taddress\t= %s", data ); |
158 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->netmask, data, INET_ADDRSTRLEN ); |
159 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->netmask, data, INET_ADDRSTRLEN ); |
159 | printf( "\n -netmask =\t%s", data ); |
160 | printf( "\n\tnetmask\t= %s", data ); |
160 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->gateway, data, INET_ADDRSTRLEN ); |
161 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->gateway, data, INET_ADDRSTRLEN ); |
161 | printf( "\n -gateway =\t%s", data ); |
162 | printf( "\n\tgateway\t= %s", data ); |
162 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast, data, INET_ADDRSTRLEN ); |
163 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast, data, INET_ADDRSTRLEN ); |
163 | printf( "\n -broadcast =\t%s", data ); |
164 | printf( "\n\tbroadcast\t= %s", data ); |
164 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns1, data, INET_ADDRSTRLEN ); |
165 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns1, data, INET_ADDRSTRLEN ); |
165 | printf( "\n -dns1 =\t%s", data ); |
166 | printf( "\n\tdns1\t= %s", data ); |
166 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns2, data, INET_ADDRSTRLEN ); |
167 | inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns2, data, INET_ADDRSTRLEN ); |
167 | printf( "\n -dns2 =\t%s", data ); |
168 | printf( "\n\tdns2\t= %s", data ); |
168 | free( data ); |
169 | free( data ); |
169 | } |
170 | } |
170 | // TODO mapping |
171 | // TODO mapping |
171 | ip_netif->phone = bind_service( service, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
172 | ip_netif->phone = bind_service( service, ip_netif->device_id, SERVICE_IP, 0, ip_driver_receiver ); |
172 | if( ERROR_OCCURRED( ip_netifs_add( & ip_globals.netifs, ip_netif->device_id, ip_netif ))){ |
173 | if( ERROR_OCCURRED( ip_netifs_add( & ip_globals.netifs, ip_netif->device_id, ip_netif ))){ |
Line 238... | Line 239... | ||
238 | proto->phone = phone; |
239 | proto->phone = phone; |
239 | if( ERROR_OCCURRED( ip_protos_add( & ip_globals.protos, proto->protocol, proto ))){ |
240 | if( ERROR_OCCURRED( ip_protos_add( & ip_globals.protos, proto->protocol, proto ))){ |
240 | free( proto ); |
241 | free( proto ); |
241 | return ERROR_CODE; |
242 | return ERROR_CODE; |
242 | } |
243 | } |
- | 244 | printf( "\nNew protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d", proto->protocol, proto->phone ); |
|
243 | return EOK; |
245 | return EOK; |
244 | } |
246 | } |
245 | 247 | ||
246 | int ip_send_message( device_id_t device_id, packet_t packet ){ |
248 | int ip_send_message( device_id_t device_id, packet_t packet ){ |
247 | // TODO send packet |
249 | // TODO send packet |