[fe8dfa6] | 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 |
|
---|
| 29 | /** @addtogroup libnet
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | /** @file
|
---|
| 34 | * Network interface layer modules common skeleton.
|
---|
| 35 | * All network interface layer modules have to implement this interface.
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 | #ifndef LIBNET_NIL_SKEL_H_
|
---|
| 39 | #define LIBNET_NIL_SKEL_H_
|
---|
| 40 |
|
---|
| 41 | #include <ipc/services.h>
|
---|
| 42 | #include <adt/measured_strings.h>
|
---|
| 43 | #include <net/device.h>
|
---|
| 44 | #include <net/packet.h>
|
---|
[6b82009] | 45 | #include <async.h>
|
---|
[fe8dfa6] | 46 |
|
---|
| 47 | /** Module initialization.
|
---|
| 48 | *
|
---|
[797b704] | 49 | * This has to be implemented in user code.
|
---|
[fe8dfa6] | 50 | *
|
---|
[6b82009] | 51 | * @param[in] sess Networking module session.
|
---|
[fe8dfa6] | 52 | *
|
---|
| 53 | * @return EOK on success.
|
---|
| 54 | * @return Other error codes as defined for each specific module
|
---|
| 55 | * initialize function.
|
---|
| 56 | *
|
---|
| 57 | */
|
---|
[6b82009] | 58 | extern int nil_initialize(async_sess_t *sess);
|
---|
[fe8dfa6] | 59 |
|
---|
| 60 | /** Notify the network interface layer about the device state change.
|
---|
[797b704] | 61 | *
|
---|
| 62 | * This has to be implemented in user code.
|
---|
[fe8dfa6] | 63 | *
|
---|
| 64 | * @param[in] device_id Device identifier.
|
---|
| 65 | * @param[in] state New device state.
|
---|
| 66 | *
|
---|
| 67 | * @return EOK on success.
|
---|
| 68 | * @return Other error codes as defined for each specific module
|
---|
| 69 | * device state function.
|
---|
| 70 | *
|
---|
| 71 | */
|
---|
[609243f4] | 72 | extern int nil_device_state_msg_local(nic_device_id_t device_id, sysarg_t state);
|
---|
[fe8dfa6] | 73 |
|
---|
| 74 | /** Pass the packet queue to the network interface layer.
|
---|
| 75 | *
|
---|
| 76 | * Process and redistribute the received packet queue to the registered
|
---|
| 77 | * upper layers.
|
---|
| 78 | *
|
---|
[797b704] | 79 | * This has to be implemented in user code.
|
---|
| 80 | *
|
---|
[fe8dfa6] | 81 | * @param[in] device_id Source device identifier.
|
---|
| 82 | * @param[in] packet Received packet or the received packet queue.
|
---|
| 83 | *
|
---|
| 84 | * @return EOK on success.
|
---|
| 85 | * @return Other error codes as defined for each specific module
|
---|
| 86 | * received function.
|
---|
| 87 | *
|
---|
| 88 | */
|
---|
[609243f4] | 89 | extern int nil_received_msg_local(nic_device_id_t device_id, packet_t *packet);
|
---|
[fe8dfa6] | 90 |
|
---|
| 91 | /** Message processing function.
|
---|
[797b704] | 92 | *
|
---|
| 93 | * This has to be implemented in user code.
|
---|
[fe8dfa6] | 94 | *
|
---|
| 95 | * @param[in] callid Message identifier.
|
---|
| 96 | * @param[in] call Message parameters.
|
---|
| 97 | * @param[out] answer Message answer parameters.
|
---|
| 98 | * @param[out] count Message answer arguments.
|
---|
| 99 | *
|
---|
| 100 | * @return EOK on success.
|
---|
| 101 | * @return ENOTSUP if the message is not known.
|
---|
| 102 | * @return Other error codes as defined for each specific module
|
---|
| 103 | * message function.
|
---|
| 104 | *
|
---|
| 105 | * @see IS_NET_NIL_MESSAGE()
|
---|
| 106 | *
|
---|
| 107 | */
|
---|
[6b82009] | 108 | extern int nil_module_message(ipc_callid_t callid, ipc_call_t *call,
|
---|
| 109 | ipc_call_t *answer, size_t *count);
|
---|
[fe8dfa6] | 110 |
|
---|
[6b82009] | 111 | extern int nil_module_start(sysarg_t);
|
---|
[fe8dfa6] | 112 |
|
---|
| 113 | #endif
|
---|
| 114 |
|
---|
| 115 | /** @}
|
---|
| 116 | */
|
---|