Changeset fe8dfa6 in mainline for uspace/lib/net/nil/nil_skel.c
- Timestamp:
- 2011-01-11T15:57:39Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77429d3
- Parents:
- 04aade50
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/nil/nil_skel.c
r04aade50 rfe8dfa6 27 27 */ 28 28 29 /** @addtogroup nildummy29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Dummy network interface layer module stub.35 * @see module.c34 * Network network interface layer module implementation. 35 * @see nil_skel.h 36 36 */ 37 37 38 #include <async.h> 39 #include <stdio.h> 38 #include <bool.h> 40 39 #include <errno.h> 40 #include <nil_skel.h> 41 #include <net_interface.h> 42 #include <net/modules.h> 41 43 42 #include <ipc/ipc.h> 43 #include <ipc/services.h> 44 /** Default thread for new connections. 45 * 46 * @param[in] iid The initial message identifier. 47 * @param[in] icall The initial message call structure. 48 * 49 */ 50 static void nil_client_connection(ipc_callid_t iid, ipc_call_t *icall) 51 { 52 /* 53 * Accept the connection by answering 54 * the initial IPC_M_CONNECT_ME_TO call. 55 */ 56 ipc_answer_0(iid, EOK); 57 58 while (true) { 59 ipc_call_t answer; 60 size_t count; 61 62 /* Clear the answer structure */ 63 refresh_answer(&answer, &count); 64 65 /* Fetch the next message */ 66 ipc_call_t call; 67 ipc_callid_t callid = async_get_call(&call); 68 69 /* Process the message */ 70 int res = nil_module_message(callid, &call, &answer, 71 &count); 72 73 /* 74 * End if told to either by the message or the processing 75 * result. 76 */ 77 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 78 (res == EHANGUP)) 79 return; 80 81 /* Answer the message */ 82 answer_call(callid, res, &answer, count); 83 } 84 } 44 85 45 #include <net/modules.h> 46 #include <net_interface.h> 47 #include <net/packet.h> 48 #include <nil_local.h> 49 50 #include "nildummy.h" 51 52 int nil_module_start_standalone(async_client_conn_t client_connection) 86 /** Start the network interface layer module. 87 * 88 * Initialize the client connection serving function, initialize 89 * the module, register the module service and start the async 90 * manager, processing IPC messages in an infinite loop. 91 * 92 * @param[in] service Service identification. 93 * 94 * @return EOK on success. 95 * @return Other error codes as defined for the pm_init() function. 96 * @return Other error codes as defined for the nil_initialize() 97 * function. 98 * @return Other error codes as defined for the REGISTER_ME() macro 99 * function. 100 * 101 */ 102 int nil_module_start(int service) 53 103 { 54 sysarg_t phonehash; 55 int rc; 56 57 async_set_client_connection(client_connection); 104 async_set_client_connection(nil_client_connection); 58 105 int net_phone = net_connect_module(); 59 106 60 rc = pm_init();107 int rc = pm_init(); 61 108 if (rc != EOK) 62 109 return rc; 63 64 110 65 111 rc = nil_initialize(net_phone); … … 67 113 goto out; 68 114 69 rc = ipc_connect_to_me(PHONE_NS, SERVICE_NILDUMMY, 0, 0, &phonehash); 115 sysarg_t phonehash; 116 rc = ipc_connect_to_me(PHONE_NS, service, 0, 0, &phonehash); 70 117 if (rc != EOK) 71 118 goto out; 72 119 73 120 async_manager(); 74 121 75 122 out: 76 123 pm_destroy(); … … 78 125 } 79 126 80 int nil_module_message_standalone(const char *name, ipc_callid_t callid,81 ipc_call_t *call, ipc_call_t *answer, size_t *count)82 {83 return nil_message_standalone(name, callid, call, answer, count);84 }85 86 127 /** @} 87 128 */
Note:
See TracChangeset
for help on using the changeset viewer.