Changeset 8fb1bf82 in mainline for uspace/lib/net/tl/tl_interface.c
- Timestamp:
- 2010-11-25T13:42:50Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8df8415
- Parents:
- a93d79a (diff), eb667613 (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 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/tl/tl_interface.c
ra93d79a r8fb1bf82 27 27 */ 28 28 29 /** @addtogroup net29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 /** @file 33 #include <tl_interface.h> 34 #include <generic.h> 35 #include <packet_client.h> 36 37 #include <ipc/services.h> 38 #include <ipc/tl.h> 39 40 #include <net/device.h> 41 #include <net/packet.h> 42 43 /** Notify the remote transport layer modules about the received packet/s. 34 44 * 35 * Start the networking subsystem. 36 * Perform networking self-test if executed 37 * with the -s argument. 45 * @param[in] tl_phone The transport layer module phone used for remote calls. 46 * @param[in] device_id The device identifier. 47 * @param[in] packet The received packet or the received packet queue. 48 * The packet queue is used to carry a fragmented 49 * datagram. The first packet contains the headers, 50 * the others contain only data. 51 * @param[in] target The target transport layer module service to be 52 * delivered to. 53 * @param[in] error The packet error reporting service. Prefixes the 54 * received packet. 55 * 56 * @return EOK on success. 38 57 * 39 58 */ 40 41 #define NAME "netstart" 42 43 #include <async.h> 44 #include <stdio.h> 45 #include <task.h> 46 #include <str_error.h> 47 #include <err.h> 48 #include <ipc/ipc.h> 49 #include <ipc/services.h> 50 #include <ipc/net_net.h> 51 52 #include <net/modules.h> 53 54 #include "self_test.h" 55 56 /** Start a module. 57 * 58 * @param[in] desc The module description 59 * @param[in] path The module absolute path. 60 * 61 * @returns true on succesful spanwning 62 * @returns false on failure 63 * 64 */ 65 static bool spawn(const char *desc, const char *path) 59 int 60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 61 services_t target, services_t error) 66 62 { 67 printf("%s: Spawning %s (%s)\n", NAME, desc, path); 68 69 const char *argv[2]; 70 71 argv[0] = path; 72 argv[1] = NULL; 73 74 int err; 75 if (task_spawn(path, argv, &err) == 0) { 76 fprintf(stderr, "%s: Error spawning %s (%s)\n", NAME, path, 77 str_error(err)); 78 return false; 79 } 80 81 return true; 82 } 83 84 int main(int argc, char *argv[]) 85 { 86 ERROR_DECLARE; 87 88 /* Run self-tests */ 89 if ((argc > 1) && (str_cmp(argv[1], "-s") == 0)) 90 ERROR_PROPAGATE(self_test()); 91 92 if (!spawn("networking service", "/srv/net")) 93 return EINVAL; 94 95 printf("%s: Initializing networking\n", NAME); 96 97 int net_phone = connect_to_service(SERVICE_NETWORKING); 98 if (ERROR_OCCURRED(ipc_call_sync_0_0(net_phone, NET_NET_STARTUP))) { 99 fprintf(stderr, "%s: Startup error %d\n", NAME, ERROR_CODE); 100 return ERROR_CODE; 101 } 102 103 return EOK; 63 return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id, 64 packet_get_id(packet), target, error); 104 65 } 105 66
Note:
See TracChangeset
for help on using the changeset viewer.