Changeset 849ed54 in mainline for uspace/srv/net/netif
- Timestamp:
- 2010-03-30T18:39:04Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7553689
- Parents:
- 7d6fe4db
- Location:
- uspace/srv/net/netif/lo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/netif/lo/Makefile
r7d6fe4db r849ed54 28 28 # 29 29 30 NET_BASE = ../..31 30 USPACE_PREFIX = ../../../.. 32 31 ROOT_PATH = $(USPACE_PREFIX)/.. 32 LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a 33 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include 33 34 34 35 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common 35 36 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config 36 37 37 BINARY = lo38 39 38 -include $(COMMON_MAKEFILE) 40 39 -include $(CONFIG_MAKEFILE) 41 40 42 SOURCES = \ 43 lo.c \ 44 $(NET_BASE)/module.c \ 45 $(NET_BASE)/modules.c \ 46 $(NET_BASE)/net/net_remote.c \ 47 $(NET_BASE)/netif/netif.c \ 48 $(NET_BASE)/structures/measured_strings.c \ 49 $(NET_BASE)/structures/packet/packet.c \ 50 $(NET_BASE)/structures/packet/packet_client.c \ 51 $(NET_BASE)/structures/packet/packet_remote.c 41 ifeq ($(CONFIG_NETWORKING),modular) 42 BINARY = lo 43 endif 52 44 53 45 ifeq ($(CONFIG_NETWORKING),module) 54 SOURCES += \ 55 $(NET_BASE)/nil/nildummy/nildummy.c \ 56 $(NET_BASE)/netif/netif_nil_bundle.c 46 LIBRARY = liblo 57 47 endif 58 48 59 ifeq ($(CONFIG_NETWORKING),modular) 60 SOURCES += \ 61 $(NET_BASE)/nil/nil_remote.c \ 62 $(NET_BASE)/netif/netif_standalone.c 63 endif 49 SOURCES = \ 50 lo.c 64 51 65 52 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/netif/lo/lo.c
r7d6fe4db r849ed54 43 43 #include <ipc/services.h> 44 44 45 #include "../../err.h" 46 #include "../../messages.h" 47 #include "../../modules.h" 48 49 #include "../../structures/measured_strings.h" 50 #include "../../structures/packet/packet_client.h" 51 52 #include "../../include/device.h" 53 #include "../../include/nil_interface.h" 54 55 #include "../../nil/nil_messages.h" 56 57 #include "../netif.h" 58 #include "../netif_module.h" 45 #include <net_err.h> 46 #include <net_messages.h> 47 #include <net_modules.h> 48 #include <adt/measured_strings.h> 49 #include <packet/packet_client.h> 50 #include <net_device.h> 51 #include <nil_interface.h> 52 #include <nil_messages.h> 53 #include <netif.h> 54 #include <netif_module.h> 59 55 60 56 /** Default hardware address. … … 90 86 */ 91 87 int create(device_id_t device_id, device_ref * device); 92 93 /** Prints the module name.94 * @see NAME95 */96 void module_print_name(void);97 88 98 89 int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ … … 167 158 } 168 159 169 void module_print_name(void){170 printf("%s", NAME);171 }172 173 160 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){ 174 161 ERROR_DECLARE; … … 220 207 } 221 208 209 #ifdef CONFIG_NETWORKING_modular 210 211 #include <netif_standalone.h> 212 213 /** Default thread for new connections. 214 * 215 * @param[in] iid The initial message identifier. 216 * @param[in] icall The initial message call structure. 217 * 218 */ 219 static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall) 220 { 221 /* 222 * Accept the connection 223 * - Answer the first IPC_M_CONNECT_ME_TO call. 224 */ 225 ipc_answer_0(iid, EOK); 226 227 while(true) { 228 ipc_call_t answer; 229 int answer_count; 230 231 /* Clear the answer structure */ 232 refresh_answer(&answer, &answer_count); 233 234 /* Fetch the next message */ 235 ipc_call_t call; 236 ipc_callid_t callid = async_get_call(&call); 237 238 /* Process the message */ 239 int res = netif_module_message(callid, &call, &answer, &answer_count); 240 241 /* End if said to either by the message or the processing result */ 242 if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)) 243 return; 244 245 /* Answer the message */ 246 answer_call(callid, res, &answer, answer_count); 247 } 248 } 249 250 /** Starts the module. 251 * 252 * @param argc The count of the command line arguments. Ignored parameter. 253 * @param argv The command line parameters. Ignored parameter. 254 * 255 * @returns EOK on success. 256 * @returns Other error codes as defined for each specific module start function. 257 * 258 */ 259 int main(int argc, char *argv[]) 260 { 261 ERROR_DECLARE; 262 263 /* Print the module label */ 264 printf("Task %d - %s\n", task_get_id(), NAME); 265 266 /* Start the module */ 267 if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) { 268 printf(" - ERROR %i\n", ERROR_CODE); 269 return ERROR_CODE; 270 } 271 272 return EOK; 273 } 274 275 #endif /* CONFIG_NETWORKING_modular */ 276 222 277 /** @} 223 278 */
Note:
See TracChangeset
for help on using the changeset viewer.