Changeset 59ecd4a in mainline for uspace/srv/net/net/net.c
- Timestamp:
- 2010-04-04T21:41:47Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5db9084
- Parents:
- 36a75a2 (diff), ee7e82a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/net/net.c
r36a75a2 r59ecd4a 46 46 #include <ipc/services.h> 47 47 48 #include "../err.h" 49 #include "../messages.h" 50 #include "../modules.h" 51 52 #include "../structures/char_map.h" 53 #include "../structures/generic_char_map.h" 54 #include "../structures/measured_strings.h" 55 #include "../structures/module_map.h" 56 #include "../structures/packet/packet.h" 57 58 #include "../il/il_messages.h" 59 #include "../include/device.h" 60 #include "../include/netif_interface.h" 61 #include "../include/nil_interface.h" 62 #include "../include/net_interface.h" 63 #include "../include/ip_interface.h" 48 #include <net_err.h> 49 #include <net_messages.h> 50 #include <net_modules.h> 51 #include <adt/char_map.h> 52 #include <adt/generic_char_map.h> 53 #include <adt/measured_strings.h> 54 #include <adt/module_map.h> 55 #include <packet/packet.h> 56 #include <il_messages.h> 57 #include <net_device.h> 58 #include <netif_interface.h> 59 #include <nil_interface.h> 60 #include <net_interface.h> 61 #include <ip_interface.h> 62 #include <net_net_messages.h> 64 63 65 64 #include "net.h" 66 #include "net_messages.h"67 65 68 66 /** File read buffer size. … … 82 80 */ 83 81 device_id_t generate_new_device_id(void); 84 85 /** Prints the module name.86 * @see NAME87 */88 void module_print_name(void);89 90 /** Starts the networking module.91 * Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.92 * @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.93 * @returns EOK on successful module termination.94 * @returns Other error codes as defined for the net_initialize() function.95 * @returns Other error codes as defined for the REGISTER_ME() macro function.96 */97 int module_start(async_client_conn_t client_connection);98 82 99 83 /** Returns the configured values. … … 185 169 } 186 170 187 void module_print_name(void){ 188 printf("%s", NAME); 189 } 190 191 int module_start(async_client_conn_t client_connection){ 171 /** Starts the networking module. 172 * Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop. 173 * @param[in] client_connection The client connection processing function. The module skeleton propagates its own one. 174 * @returns EOK on successful module termination. 175 * @returns Other error codes as defined for the net_initialize() function. 176 * @returns Other error codes as defined for the REGISTER_ME() macro function. 177 */ 178 static int net_module_start(async_client_conn_t client_connection){ 192 179 ERROR_DECLARE; 193 180 … … 511 498 ERROR_DECLARE; 512 499 513 #ifdef CONFIG_NETIF_DP8390514 500 const char * conf_files[] = {"lo", "ne2k"}; 515 #else516 const char * conf_files[] = {"lo"};517 #endif518 501 519 502 int count = sizeof(conf_files) / sizeof(char *); … … 580 563 } 581 564 565 /** Default thread for new connections. 566 * 567 * @param[in] iid The initial message identifier. 568 * @param[in] icall The initial message call structure. 569 * 570 */ 571 static void net_client_connection(ipc_callid_t iid, ipc_call_t * icall) 572 { 573 /* 574 * Accept the connection 575 * - Answer the first IPC_M_CONNECT_ME_TO call. 576 */ 577 ipc_answer_0(iid, EOK); 578 579 while(true) { 580 ipc_call_t answer; 581 int answer_count; 582 583 /* Clear the answer structure */ 584 refresh_answer(&answer, &answer_count); 585 586 /* Fetch the next message */ 587 ipc_call_t call; 588 ipc_callid_t callid = async_get_call(&call); 589 590 /* Process the message */ 591 int res = net_module_message(callid, &call, &answer, &answer_count); 592 593 /* End if said to either by the message or the processing result */ 594 if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)) 595 return; 596 597 /* Answer the message */ 598 answer_call(callid, res, &answer, answer_count); 599 } 600 } 601 602 /** Starts the module. 603 * 604 * @param argc The count of the command line arguments. Ignored parameter. 605 * @param argv The command line parameters. Ignored parameter. 606 * 607 * @returns EOK on success. 608 * @returns Other error codes as defined for each specific module start function. 609 * 610 */ 611 int main(int argc, char *argv[]) 612 { 613 ERROR_DECLARE; 614 615 /* Print the module label */ 616 printf("Task %d - %s\n", task_get_id(), NAME); 617 618 /* Start the module */ 619 if (ERROR_OCCURRED(net_module_start(net_client_connection))) { 620 printf(" - ERROR %i\n", ERROR_CODE); 621 return ERROR_CODE; 622 } 623 624 return EOK; 625 } 626 582 627 /** @} 583 628 */
Note:
See TracChangeset
for help on using the changeset viewer.