Changes in uspace/srv/net/net/net.c [d0d1f4f:3a5d892f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/net/net.c
rd0d1f4f r3a5d892f 36 36 */ 37 37 38 #include "net.h"39 40 38 #include <async.h> 41 39 #include <ctype.h> … … 54 52 55 53 #include <net/modules.h> 56 #include <net/packet.h>57 #include <net/device.h>58 59 54 #include <adt/char_map.h> 60 55 #include <adt/generic_char_map.h> 61 56 #include <adt/measured_strings.h> 62 57 #include <adt/module_map.h> 63 58 #include <net/packet.h> 64 59 #include <netif_remote.h> 60 #include <net/device.h> 65 61 #include <nil_interface.h> 66 62 #include <net_interface.h> 67 63 #include <ip_interface.h> 68 64 69 /** Networking module name. */ 65 #include "net.h" 66 67 /** Networking module name. 68 * 69 */ 70 70 #define NAME "net" 71 71 72 /** File read buffer size. */ 72 /** File read buffer size. 73 * 74 */ 73 75 #define BUFFER_SIZE 256 74 76 75 /** Networking module global data. */ 77 /** Networking module global data. 78 * 79 */ 76 80 net_globals_t net_globals; 77 81 … … 96 100 measured_string_ref setting = 97 101 measured_string_create_bulk(value, 0); 102 98 103 if (!setting) 99 104 return ENOMEM; … … 201 206 unsigned int line_number = 0; 202 207 size_t index = 0; 203 while ( !ferror(cfg) && !feof(cfg)) {208 while ((!ferror(cfg)) && (!feof(cfg))) { 204 209 int read = fgetc(cfg); 205 210 if ((read > 0) && (read != '\n') && (read != '\r')) { … … 321 326 ipcarg_t phonehash; 322 327 323 if (ERROR_OCCURRED(net_initialize(client_connection)) ||324 ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){328 if (ERROR_OCCURRED(net_initialize(client_connection)) 329 || ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){ 325 330 pm_destroy(); 326 331 return ERROR_CODE; … … 374 379 size_t count, char **data) 375 380 { 376 if (! configuration || (count <= 0))381 if (!(configuration && (count > 0))) 377 382 return EINVAL; 378 383 … … 477 482 /* Inter-network layer startup */ 478 483 switch (netif->il->service) { 479 case SERVICE_IP:480 ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id,481 internet_service));482 break;483 default:484 return ENOENT;484 case SERVICE_IP: 485 ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id, 486 internet_service)); 487 break; 488 default: 489 return ENOENT; 485 490 } 486 491 … … 506 511 ERROR_DECLARE; 507 512 508 const char *conf_files[] = { 509 "lo", 510 "ne2k" 511 }; 513 const char *conf_files[] = {"lo", "ne2k"}; 512 514 size_t count = sizeof(conf_files) / sizeof(char *); 513 515 … … 601 603 *answer_count = 0; 602 604 switch (IPC_GET_METHOD(*call)) { 603 case IPC_M_PHONE_HUNGUP:604 return EOK;605 case NET_NET_GET_DEVICE_CONF:606 ERROR_PROPAGATE(measured_strings_receive(&strings, &data,607 IPC_GET_COUNT(call)));608 net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,609 IPC_GET_COUNT(call), NULL);610 611 /* Strings should not contain received data anymore */612 free(data);613 614 ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));615 free(strings);616 return ERROR_CODE;617 case NET_NET_GET_CONF:618 ERROR_PROPAGATE(measured_strings_receive(&strings, &data,619 IPC_GET_COUNT(call)));620 net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);621 622 /* Strings should not contain received data anymore */623 free(data);624 625 ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));626 free(strings);627 return ERROR_CODE;628 case NET_NET_STARTUP:629 return startup();605 case IPC_M_PHONE_HUNGUP: 606 return EOK; 607 case NET_NET_GET_DEVICE_CONF: 608 ERROR_PROPAGATE(measured_strings_receive(&strings, &data, 609 IPC_GET_COUNT(call))); 610 net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings, 611 IPC_GET_COUNT(call), NULL); 612 613 /* Strings should not contain received data anymore */ 614 free(data); 615 616 ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call)); 617 free(strings); 618 return ERROR_CODE; 619 case NET_NET_GET_CONF: 620 ERROR_PROPAGATE(measured_strings_receive(&strings, &data, 621 IPC_GET_COUNT(call))); 622 net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL); 623 624 /* Strings should not contain received data anymore */ 625 free(data); 626 627 ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call)); 628 free(strings); 629 return ERROR_CODE; 630 case NET_NET_STARTUP: 631 return startup(); 630 632 } 631 633 return ENOTSUP; … … 659 661 int res = net_module_message(callid, &call, &answer, &answer_count); 660 662 661 /* End if told to either by the message or the processing result */663 /* End if said to either by the message or the processing result */ 662 664 if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)) 663 665 return;
Note:
See TracChangeset
for help on using the changeset viewer.