Changeset fe8dfa6 in mainline for uspace/lib/net
- 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
- Location:
- uspace/lib/net
- Files:
-
- 1 added
- 2 deleted
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/Makefile
r04aade50 rfe8dfa6 43 43 netif/netif_skel.c \ 44 44 nil/nil_remote.c \ 45 nil/nil_skel.c \ 45 46 il/il_interface.c \ 46 47 il/ip_remote.c \ -
uspace/lib/net/include/nil_remote.h
r04aade50 rfe8dfa6 37 37 #include <net/device.h> 38 38 #include <net/packet.h> 39 #include <generic.h> 39 40 40 extern int nil_device_state_msg_remote(int, device_id_t, int); 41 extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t); 41 #define nil_bind_service(service, device_id, me, receiver) \ 42 bind_service(service, device_id, me, 0, receiver) 43 44 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 45 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \ 46 device_id, packet_dimension) 47 48 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 49 generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data) 50 51 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 52 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \ 53 address, data) 54 55 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 56 generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \ 57 packet_get_id(packet), sender, 0) 58 59 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 60 generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \ 61 netif_service) 62 63 extern int nil_device_state_msg(int, device_id_t, int); 64 extern int nil_received_msg(int, device_id_t, packet_t *, services_t); 42 65 43 66 #endif -
uspace/lib/net/netif/netif_skel.c
r04aade50 rfe8dfa6 33 33 /** @file 34 34 * Network interface module skeleton implementation. 35 * @see netif .h35 * @see netif_skel.h 36 36 */ 37 37 … … 52 52 #include <adt/measured_strings.h> 53 53 #include <net/device.h> 54 #include <nil_interface.h>55 54 #include <netif_skel.h> 55 #include <nil_remote.h> 56 56 57 57 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t); -
uspace/lib/net/nil/nil_remote.c
r04aade50 rfe8dfa6 33 33 /** @file 34 34 * Network interface layer interface implementation for remote modules. 35 * @see nil_ interface.h35 * @see nil_remote.h 36 36 */ 37 37 38 38 #include <nil_remote.h> 39 #include <nil_interface.h>40 39 #include <generic.h> 41 40 #include <net/device.h> 42 41 #include <net/packet.h> 43 42 #include <packet_client.h> 44 45 43 #include <ipc/nil.h> 46 44 47 45 /** Notify the network interface layer about the device state change. 48 46 * 49 * @param[in] nil_phone The network interface layer phone. 50 * @param[in] device_id The device identifier. 51 * @param[in] state The new device state. 52 * @return EOK on success. 53 * @return Other error codes as defined for each specific module 54 * device state function. 47 * @param[in] nil_phone Network interface layer phone. 48 * @param[in] device_id Device identifier. 49 * @param[in] state New device state. 50 * 51 * @return EOK on success. 52 * @return Other error codes as defined for each specific module 53 * device state function. 54 * 55 55 */ 56 int nil_device_state_msg _remote(int nil_phone, device_id_t device_id, int state)56 int nil_device_state_msg(int nil_phone, device_id_t device_id, int state) 57 57 { 58 58 return generic_device_state_msg_remote(nil_phone, NET_NIL_DEVICE_STATE, … … 65 65 * upper layers. 66 66 * 67 * @param[in] nil_phone The network interface layer phone. 68 * @param[in] device_id The source device identifier. 69 * @param[in] packet The received packet or the received packet queue. 70 * @param target The target service. Ignored parameter. 71 * @return EOK on success. 72 * @return Other error codes as defined for each specific module 73 * received function. 67 * @param[in] nil_phone Network interface layer phone. 68 * @param[in] device_id Source device identifier. 69 * @param[in] packet Received packet or the received packet queue. 70 * @param[in] target Target service. Ignored parameter. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module 74 * received function. 75 * 74 76 */ 75 int nil_received_msg _remote(int nil_phone, device_id_t device_id,77 int nil_received_msg(int nil_phone, device_id_t device_id, 76 78 packet_t *packet, services_t target) 77 79 { -
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.