1 | /*
|
---|
2 | * Copyright (c) 2011 Radim Vansa
|
---|
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 | /**
|
---|
30 | * @addtogroup libnic
|
---|
31 | * @{
|
---|
32 | */
|
---|
33 | /**
|
---|
34 | * @file
|
---|
35 | * @brief Wake-on-LAN support
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef __NIC_WOL_VIRTUES_H__
|
---|
39 | #define __NIC_WOL_VIRTUES_H__
|
---|
40 |
|
---|
41 | #ifndef LIBNIC_INTERNAL
|
---|
42 | #error "This is internal libnic's header, please do not include it"
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #include <nic/nic.h>
|
---|
46 | #include <adt/hash_table.h>
|
---|
47 | #include "nic.h"
|
---|
48 |
|
---|
49 | typedef struct nic_wol_virtues {
|
---|
50 | /**
|
---|
51 | * Operations for table
|
---|
52 | */
|
---|
53 | hash_table_ops_t table_operations;
|
---|
54 | /**
|
---|
55 | * WOL virtues hashed by their ID's.
|
---|
56 | */
|
---|
57 | hash_table_t table;
|
---|
58 | /**
|
---|
59 | * WOL virtues in lists by their type
|
---|
60 | */
|
---|
61 | nic_wol_virtue_t *lists[NIC_WV_MAX];
|
---|
62 | /**
|
---|
63 | * Number of virtues in the wv_types list
|
---|
64 | */
|
---|
65 | size_t lists_sizes[NIC_WV_MAX];
|
---|
66 | /**
|
---|
67 | * Counter for the ID's
|
---|
68 | */
|
---|
69 | nic_wv_id_t next_id;
|
---|
70 | /**
|
---|
71 | * Maximum capabilities
|
---|
72 | */
|
---|
73 | int caps_max[NIC_WV_MAX];
|
---|
74 | } nic_wol_virtues_t;
|
---|
75 |
|
---|
76 | extern errno_t nic_wol_virtues_init(nic_wol_virtues_t *);
|
---|
77 | extern void nic_wol_virtues_clear(nic_wol_virtues_t *);
|
---|
78 | extern errno_t nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
|
---|
79 | extern errno_t nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
|
---|
80 | size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
|
---|
81 | extern errno_t nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
|
---|
82 | extern nic_wol_virtue_t *nic_wol_virtues_remove(nic_wol_virtues_t *,
|
---|
83 | nic_wv_id_t);
|
---|
84 | extern const nic_wol_virtue_t *nic_wol_virtues_find(const nic_wol_virtues_t *,
|
---|
85 | nic_wv_id_t);
|
---|
86 |
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | /** @}
|
---|
90 | */
|
---|