Changes in uspace/srv/net/netif/lo/lo.c [f87c900:774e6d1a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/netif/lo/lo.c
rf87c900 r774e6d1a 49 49 #include <net/device.h> 50 50 #include <nil_interface.h> 51 #include <netif_interface.h> 52 #include <netif_local.h> 51 #include <netif_skel.h> 53 52 54 53 /** Default hardware address. */ 55 #define DEFAULT_ADDR "\0\0\0\0\0\0"54 #define DEFAULT_ADDR 0 56 55 57 56 /** Default address length. */ 58 #define DEFAULT_ADDR_LEN (sizeof(DEFAULT_ADDR) / sizeof(char))57 #define DEFAULT_ADDR_LEN 6 59 58 60 59 /** Loopback module name. */ … … 62 61 63 62 /** Network interface global data. */ 64 netif_globals_t 63 netif_globals_t netif_globals; 65 64 66 65 int netif_specific_message(ipc_callid_t callid, ipc_call_t *call, 67 ipc_call_t *answer, int *answer_count)66 ipc_call_t *answer, size_t *count) 68 67 { 69 68 return ENOTSUP; … … 74 73 if (!address) 75 74 return EBADMEM; 76 77 address->value = str_dup(DEFAULT_ADDR); 75 76 uint8_t *addr = (uint8_t *) malloc(DEFAULT_ADDR_LEN); 77 memset(addr, DEFAULT_ADDR, DEFAULT_ADDR_LEN); 78 79 address->value = addr; 78 80 address->length = DEFAULT_ADDR_LEN; 79 81 80 82 return EOK; 81 83 } … … 169 171 } 170 172 171 int netif_probe_message(device_id_t device_id, int irq, uintptr_tio)173 int netif_probe_message(device_id_t device_id, int irq, void *io) 172 174 { 173 175 netif_device_t *device; … … 230 232 } 231 233 232 /** Default thread for new connections.233 *234 * @param[in] iid The initial message identifier.235 * @param[in] icall The initial message call structure.236 */237 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)238 {239 /*240 * Accept the connection241 * - Answer the first IPC_M_CONNECT_ME_TO call.242 */243 ipc_answer_0(iid, EOK);244 245 while (true) {246 ipc_call_t answer;247 int answer_count;248 249 /* Clear the answer structure */250 refresh_answer(&answer, &answer_count);251 252 /* Fetch the next message */253 ipc_call_t call;254 ipc_callid_t callid = async_get_call(&call);255 256 /* Process the message */257 int res = netif_module_message(NAME, callid, &call, &answer,258 &answer_count);259 260 /*261 * End if told to either by the message or the processing262 * result.263 */264 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||265 (res == EHANGUP))266 return;267 268 /* Answer the message */269 answer_call(callid, res, &answer, answer_count);270 }271 }272 273 234 int main(int argc, char *argv[]) 274 235 { 275 int rc;276 277 236 /* Start the module */ 278 rc = netif_module_start(netif_client_connection); 279 return rc; 237 return netif_module_start(); 280 238 } 281 239
Note:
See TracChangeset
for help on using the changeset viewer.