[21580dd] | 1 | /*
|
---|
| 2 | * Copyright (c) 2009 Lukas Mejdrech
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[404dbae] | 29 | /** @addtogroup libnet
|
---|
| 30 | * @{
|
---|
[21580dd] | 31 | */
|
---|
| 32 |
|
---|
| 33 | /** @file
|
---|
[14f1db0] | 34 | * Network interface layer modules common skeleton.
|
---|
| 35 | * All network interface layer modules have to implement this interface.
|
---|
[21580dd] | 36 | */
|
---|
| 37 |
|
---|
[404dbae] | 38 | #ifndef LIBNET_NIL_LOCAL_H_
|
---|
| 39 | #define LIBNET_NIL_LOCAL_H_
|
---|
[21580dd] | 40 |
|
---|
| 41 | #include <ipc/ipc.h>
|
---|
| 42 |
|
---|
| 43 | /** Module initialization.
|
---|
[24ab58b3] | 44 | *
|
---|
| 45 | * Is called by the module_start() function.
|
---|
| 46 | *
|
---|
[404dbae] | 47 | * @param[in] net_phone The networking moduel phone.
|
---|
| 48 | * @return EOK on success.
|
---|
| 49 | * @return Other error codes as defined for each specific module
|
---|
| 50 | * initialize function.
|
---|
[21580dd] | 51 | */
|
---|
[24ab58b3] | 52 | extern int nil_initialize(int);
|
---|
[21580dd] | 53 |
|
---|
[404dbae] | 54 | /** Notify the network interface layer about the device state change.
|
---|
| 55 | *
|
---|
| 56 | * @param[in] nil_phone The network interface layer phone.
|
---|
| 57 | * @param[in] device_id The device identifier.
|
---|
| 58 | * @param[in] state The new device state.
|
---|
| 59 | * @return EOK on success.
|
---|
| 60 | * @return Other error codes as defined for each specific module
|
---|
| 61 | * device state function.
|
---|
| 62 | */
|
---|
[14f1db0] | 63 | extern int nil_device_state_msg_local(int, device_id_t, int);
|
---|
[404dbae] | 64 |
|
---|
| 65 |
|
---|
| 66 | /** Pass the packet queue to the network interface layer.
|
---|
| 67 | *
|
---|
| 68 | * Process and redistribute the received packet queue to the registered
|
---|
| 69 | * upper layers.
|
---|
| 70 | *
|
---|
| 71 | * @param[in] nil_phone The network interface layer phone.
|
---|
| 72 | * @param[in] device_id The source device identifier.
|
---|
| 73 | * @param[in] packet The received packet or the received packet queue.
|
---|
| 74 | * @param target The target service. Ignored parameter.
|
---|
| 75 | * @return EOK on success.
|
---|
| 76 | * @return Other error codes as defined for each specific module
|
---|
| 77 | * received function.
|
---|
| 78 | */
|
---|
[46d4d9f] | 79 | extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t);
|
---|
[14f1db0] | 80 |
|
---|
[21580dd] | 81 | /** Message processing function.
|
---|
[24ab58b3] | 82 | *
|
---|
[404dbae] | 83 | * @param[in] name Module name.
|
---|
| 84 | * @param[in] callid The message identifier.
|
---|
| 85 | * @param[in] call The message parameters.
|
---|
| 86 | * @param[out] answer The message answer parameters.
|
---|
| 87 | * @param[out] answer_count The last parameter for the actual answer in the
|
---|
| 88 | * answer parameter.
|
---|
| 89 | * @return EOK on success.
|
---|
| 90 | * @return ENOTSUP if the message is not known.
|
---|
| 91 | * @return Other error codes as defined for each specific module
|
---|
| 92 | * message function.
|
---|
[24ab58b3] | 93 | *
|
---|
| 94 | * @see nil_interface.h
|
---|
| 95 | * @see IS_NET_NIL_MESSAGE()
|
---|
[21580dd] | 96 | */
|
---|
[404dbae] | 97 | extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *,
|
---|
| 98 | ipc_call_t *, int *);
|
---|
[21580dd] | 99 |
|
---|
[404dbae] | 100 | /** Pass the parameters to the module specific nil_message() function.
|
---|
| 101 | *
|
---|
| 102 | * @param[in] name Module name.
|
---|
| 103 | * @param[in] callid The message identifier.
|
---|
| 104 | * @param[in] call The message parameters.
|
---|
| 105 | * @param[out] answer The message answer parameters.
|
---|
| 106 | * @param[out] answer_count The last parameter for the actual answer in the
|
---|
| 107 | * answer parameter.
|
---|
| 108 | * @return EOK on success.
|
---|
| 109 | * @return ENOTSUP if the message is not known.
|
---|
| 110 | * @return Other error codes as defined for each specific module
|
---|
| 111 | * message function.
|
---|
| 112 | */
|
---|
[14f1db0] | 113 | extern int nil_module_message_standalone(const char *, ipc_callid_t,
|
---|
| 114 | ipc_call_t *, ipc_call_t *, int *);
|
---|
[404dbae] | 115 |
|
---|
| 116 | /** Start the standalone nil layer module.
|
---|
| 117 | *
|
---|
| 118 | * Initialize the client connection serving function, initialize
|
---|
| 119 | * the module, register the module service and start the async
|
---|
| 120 | * manager, processing IPC messages in an infinite loop.
|
---|
| 121 | *
|
---|
| 122 | * @param[in] client_connection The client connection processing function.
|
---|
| 123 | * The module skeleton propagates its own one.
|
---|
| 124 | * @return EOK on success.
|
---|
| 125 | * @return Other error codes as defined for the pm_init() function.
|
---|
| 126 | * @return Other error codes as defined for the nil_initialize()
|
---|
| 127 | * function.
|
---|
| 128 | * @return Other error codes as defined for the REGISTER_ME() macro
|
---|
| 129 | * function.
|
---|
| 130 | */
|
---|
[14f1db0] | 131 | extern int nil_module_start_standalone(async_client_conn_t);
|
---|
| 132 |
|
---|
[21580dd] | 133 | #endif
|
---|
| 134 |
|
---|
| 135 | /** @}
|
---|
| 136 | */
|
---|