libnl
3.2.21
Main Page
Related Pages
Modules
Data Structures
cache.h
1
/*
2
* netlink/cache.h Caching Module
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation version 2.1
7
* of the License.
8
*
9
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
10
*/
11
12
#ifndef NETLINK_CACHE_H_
13
#define NETLINK_CACHE_H_
14
15
#include <netlink/netlink.h>
16
#include <netlink/msg.h>
17
#include <netlink/utils.h>
18
#include <netlink/object.h>
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
enum
{
25
NL_ACT_UNSPEC,
26
NL_ACT_NEW,
27
NL_ACT_DEL,
28
NL_ACT_GET,
29
NL_ACT_SET,
30
NL_ACT_CHANGE,
31
__NL_ACT_MAX,
32
};
33
34
#define NL_ACT_MAX (__NL_ACT_MAX - 1)
35
36
struct
nl_cache;
37
typedef
void (*change_func_t)(
struct
nl_cache *,
struct
nl_object *, int,
void
*);
38
39
/**
40
* @ingroup cache
41
* Explicitely iterate over all address families when updating the cache
42
*/
43
#define NL_CACHE_AF_ITER 0x0001
44
45
/* Access Functions */
46
extern
int
nl_cache_nitems
(
struct
nl_cache *);
47
extern
int
nl_cache_nitems_filter
(
struct
nl_cache *,
48
struct
nl_object *);
49
extern
struct
nl_cache_ops *
nl_cache_get_ops
(
struct
nl_cache *);
50
extern
struct
nl_object *
nl_cache_get_first
(
struct
nl_cache *);
51
extern
struct
nl_object *
nl_cache_get_last
(
struct
nl_cache *);
52
extern
struct
nl_object *
nl_cache_get_next
(
struct
nl_object *);
53
extern
struct
nl_object *
nl_cache_get_prev
(
struct
nl_object *);
54
55
extern
struct
nl_cache *
nl_cache_alloc
(
struct
nl_cache_ops *);
56
extern
int
nl_cache_alloc_and_fill
(
struct
nl_cache_ops *,
57
struct
nl_sock *,
58
struct
nl_cache **);
59
extern
int
nl_cache_alloc_name
(
const
char
*,
60
struct
nl_cache **);
61
extern
struct
nl_cache *
nl_cache_subset
(
struct
nl_cache *,
62
struct
nl_object *);
63
extern
struct
nl_cache *
nl_cache_clone
(
struct
nl_cache *);
64
extern
void
nl_cache_clear
(
struct
nl_cache *);
65
extern
void
nl_cache_get
(
struct
nl_cache *);
66
extern
void
nl_cache_free
(
struct
nl_cache *);
67
extern
void
nl_cache_put(
struct
nl_cache *cache);
68
69
/* Cache modification */
70
extern
int
nl_cache_add
(
struct
nl_cache *,
71
struct
nl_object *);
72
extern
int
nl_cache_parse_and_add
(
struct
nl_cache *,
73
struct
nl_msg *);
74
extern
void
nl_cache_remove
(
struct
nl_object *);
75
extern
int
nl_cache_refill
(
struct
nl_sock *,
76
struct
nl_cache *);
77
extern
int
nl_cache_pickup
(
struct
nl_sock *,
78
struct
nl_cache *);
79
extern
int
nl_cache_resync(
struct
nl_sock *,
80
struct
nl_cache *,
81
change_func_t,
82
void
*);
83
extern
int
nl_cache_include(
struct
nl_cache *,
84
struct
nl_object *,
85
change_func_t,
86
void
*);
87
extern
void
nl_cache_set_arg1
(
struct
nl_cache *,
int
);
88
extern
void
nl_cache_set_arg2
(
struct
nl_cache *,
int
);
89
extern
void
nl_cache_set_flags
(
struct
nl_cache *,
unsigned
int
);
90
91
/* General */
92
extern
int
nl_cache_is_empty
(
struct
nl_cache *);
93
extern
struct
nl_object *
nl_cache_search
(
struct
nl_cache *,
94
struct
nl_object *);
95
extern
struct
nl_object * nl_cache_lookup(
struct
nl_cache *,
96
struct
nl_object *);
97
extern
void
nl_cache_mark_all
(
struct
nl_cache *);
98
99
/* Dumping */
100
extern
void
nl_cache_dump
(
struct
nl_cache *,
101
struct
nl_dump_params
*);
102
extern
void
nl_cache_dump_filter
(
struct
nl_cache *,
103
struct
nl_dump_params
*,
104
struct
nl_object *);
105
106
/* Iterators */
107
extern
void
nl_cache_foreach
(
struct
nl_cache *,
108
void
(*cb)(
struct
nl_object *,
109
void
*),
110
void
*arg);
111
extern
void
nl_cache_foreach_filter
(
struct
nl_cache *,
112
struct
nl_object *,
113
void
(*cb)(
struct
114
nl_object *,
115
void
*),
116
void
*arg);
117
118
/* --- cache management --- */
119
120
/* Cache type management */
121
extern
struct
nl_cache_ops *
nl_cache_ops_lookup
(
const
char
*);
122
extern
struct
nl_cache_ops *
nl_cache_ops_lookup_safe
(
const
char
*);
123
extern
struct
nl_cache_ops *
nl_cache_ops_associate
(
int
,
int
);
124
extern
struct
nl_cache_ops *
nl_cache_ops_associate_safe
(
int
,
int
);
125
extern
struct
nl_msgtype *
nl_msgtype_lookup
(
struct
nl_cache_ops *,
int
);
126
extern
void
nl_cache_ops_foreach
(
void
(*cb)(
struct
nl_cache_ops *,
void
*),
void
*);
127
extern
int
nl_cache_mngt_register
(
struct
nl_cache_ops *);
128
extern
int
nl_cache_mngt_unregister
(
struct
nl_cache_ops *);
129
130
/* Global cache provisioning/requiring */
131
extern
void
nl_cache_mngt_provide
(
struct
nl_cache *);
132
extern
void
nl_cache_mngt_unprovide
(
struct
nl_cache *);
133
extern
struct
nl_cache *
nl_cache_mngt_require
(
const
char
*);
134
extern
struct
nl_cache *
nl_cache_mngt_require_safe
(
const
char
*);
135
extern
struct
nl_cache * __nl_cache_mngt_require(
const
char
*);
136
137
struct
nl_cache_mngr;
138
139
#define NL_AUTO_PROVIDE 1
140
#define NL_ALLOCATED_SOCK 2
/* For internal use only, do not use */
141
142
extern
int
nl_cache_mngr_alloc
(
struct
nl_sock *,
143
int
,
int
,
144
struct
nl_cache_mngr **);
145
extern
int
nl_cache_mngr_add
(
struct
nl_cache_mngr *,
146
const
char
*,
147
change_func_t,
148
void
*,
149
struct
nl_cache **);
150
extern
int
nl_cache_mngr_add_cache
(
struct
nl_cache_mngr *mngr,
151
struct
nl_cache *cache,
152
change_func_t cb,
void
*data);
153
extern
int
nl_cache_mngr_get_fd
(
struct
nl_cache_mngr *);
154
extern
int
nl_cache_mngr_poll
(
struct
nl_cache_mngr *,
155
int
);
156
extern
int
nl_cache_mngr_data_ready
(
struct
nl_cache_mngr *);
157
extern
void
nl_cache_mngr_info
(
struct
nl_cache_mngr *,
158
struct
nl_dump_params
*);
159
extern
void
nl_cache_mngr_free
(
struct
nl_cache_mngr *);
160
161
extern
void
nl_cache_ops_get
(
struct
nl_cache_ops *);
162
extern
void
nl_cache_ops_put
(
struct
nl_cache_ops *);
163
164
#ifdef __cplusplus
165
}
166
#endif
167
168
#endif
include
netlink
cache.h
Generated on Tue Apr 2 2013 15:44:50 for libnl by
1.8.1.1