Changeset d0d1f4f in mainline for uspace/srv/net/net/net.c
- Timestamp:
- 2010-11-02T23:13:21Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49d819b4, a8e5051
- Parents:
- ef4b112
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/net/net.c
ref4b112 rd0d1f4f 36 36 */ 37 37 38 #include "net.h" 39 38 40 #include <async.h> 39 41 #include <ctype.h> … … 52 54 53 55 #include <net/modules.h> 56 #include <net/packet.h> 57 #include <net/device.h> 58 54 59 #include <adt/char_map.h> 55 60 #include <adt/generic_char_map.h> 56 61 #include <adt/measured_strings.h> 57 62 #include <adt/module_map.h> 58 #include <net/packet.h> 63 59 64 #include <netif_remote.h> 60 #include <net/device.h>61 65 #include <nil_interface.h> 62 66 #include <net_interface.h> 63 67 #include <ip_interface.h> 64 68 65 #include "net.h" 66 67 /** Networking module name. 68 * 69 */ 69 /** Networking module name. */ 70 70 #define NAME "net" 71 71 72 /** File read buffer size. 73 * 74 */ 72 /** File read buffer size. */ 75 73 #define BUFFER_SIZE 256 76 74 77 /** Networking module global data. 78 * 79 */ 75 /** Networking module global data. */ 80 76 net_globals_t net_globals; 81 77 … … 100 96 measured_string_ref setting = 101 97 measured_string_create_bulk(value, 0); 102 103 98 if (!setting) 104 99 return ENOMEM; … … 206 201 unsigned int line_number = 0; 207 202 size_t index = 0; 208 while ( (!ferror(cfg)) && (!feof(cfg))) {203 while (!ferror(cfg) && !feof(cfg)) { 209 204 int read = fgetc(cfg); 210 205 if ((read > 0) && (read != '\n') && (read != '\r')) { … … 326 321 ipcarg_t phonehash; 327 322 328 if (ERROR_OCCURRED(net_initialize(client_connection)) 329 || ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){323 if (ERROR_OCCURRED(net_initialize(client_connection)) || 324 ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))) { 330 325 pm_destroy(); 331 326 return ERROR_CODE; … … 379 374 size_t count, char **data) 380 375 { 381 if (! (configuration && (count > 0)))376 if (!configuration || (count <= 0)) 382 377 return EINVAL; 383 378 … … 482 477 /* Inter-network layer startup */ 483 478 switch (netif->il->service) { 484 485 486 487 488 489 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; 490 485 } 491 486 … … 511 506 ERROR_DECLARE; 512 507 513 const char *conf_files[] = {"lo", "ne2k"}; 508 const char *conf_files[] = { 509 "lo", 510 "ne2k" 511 }; 514 512 size_t count = sizeof(conf_files) / sizeof(char *); 515 513 … … 603 601 *answer_count = 0; 604 602 switch (IPC_GET_METHOD(*call)) { 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 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(); 632 630 } 633 631 return ENOTSUP; … … 661 659 int res = net_module_message(callid, &call, &answer, &answer_count); 662 660 663 /* End if said to either by the message or the processing result */661 /* End if told to either by the message or the processing result */ 664 662 if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)) 665 663 return;
Note:
See TracChangeset
for help on using the changeset viewer.