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
struct
nl_cache;
25
typedef
void (*change_func_t)(
struct
nl_cache *,
struct
nl_object *, int,
void
*);
26
27
/**
28
* @ingroup cache
29
* Explicitely iterate over all address families when updating the cache
30
*/
31
#define NL_CACHE_AF_ITER 0x0001
32
33
/* Access Functions */
34
extern
int
nl_cache_nitems
(
struct
nl_cache *);
35
extern
int
nl_cache_nitems_filter
(
struct
nl_cache *,
36
struct
nl_object *);
37
extern
struct
nl_cache_ops *
nl_cache_get_ops
(
struct
nl_cache *);
38
extern
struct
nl_object *
nl_cache_get_first
(
struct
nl_cache *);
39
extern
struct
nl_object *
nl_cache_get_last
(
struct
nl_cache *);
40
extern
struct
nl_object *
nl_cache_get_next
(
struct
nl_object *);
41
extern
struct
nl_object *
nl_cache_get_prev
(
struct
nl_object *);
42
43
extern
struct
nl_cache *
nl_cache_alloc
(
struct
nl_cache_ops *);
44
extern
int
nl_cache_alloc_and_fill
(
struct
nl_cache_ops *,
45
struct
nl_sock *,
46
struct
nl_cache **);
47
extern
int
nl_cache_alloc_name
(
const
char
*,
48
struct
nl_cache **);
49
extern
struct
nl_cache *
nl_cache_subset
(
struct
nl_cache *,
50
struct
nl_object *);
51
extern
struct
nl_cache *
nl_cache_clone
(
struct
nl_cache *);
52
extern
void
nl_cache_clear
(
struct
nl_cache *);
53
extern
void
nl_cache_get
(
struct
nl_cache *);
54
extern
void
nl_cache_free
(
struct
nl_cache *);
55
extern
void
nl_cache_put(
struct
nl_cache *cache);
56
57
/* Cache modification */
58
extern
int
nl_cache_add
(
struct
nl_cache *,
59
struct
nl_object *);
60
extern
int
nl_cache_parse_and_add
(
struct
nl_cache *,
61
struct
nl_msg *);
62
extern
void
nl_cache_remove
(
struct
nl_object *);
63
extern
int
nl_cache_refill
(
struct
nl_sock *,
64
struct
nl_cache *);
65
extern
int
nl_cache_pickup
(
struct
nl_sock *,
66
struct
nl_cache *);
67
extern
int
nl_cache_resync(
struct
nl_sock *,
68
struct
nl_cache *,
69
change_func_t,
70
void
*);
71
extern
int
nl_cache_include(
struct
nl_cache *,
72
struct
nl_object *,
73
change_func_t,
74
void
*);
75
extern
void
nl_cache_set_arg1
(
struct
nl_cache *,
int
);
76
extern
void
nl_cache_set_arg2
(
struct
nl_cache *,
int
);
77
extern
void
nl_cache_set_flags
(
struct
nl_cache *,
unsigned
int
);
78
79
/* General */
80
extern
int
nl_cache_is_empty
(
struct
nl_cache *);
81
extern
struct
nl_object *
nl_cache_search
(
struct
nl_cache *,
82
struct
nl_object *);
83
extern
struct
nl_object * nl_cache_lookup(
struct
nl_cache *,
84
struct
nl_object *);
85
extern
void
nl_cache_mark_all
(
struct
nl_cache *);
86
87
/* Dumping */
88
extern
void
nl_cache_dump
(
struct
nl_cache *,
89
struct
nl_dump_params
*);
90
extern
void
nl_cache_dump_filter
(
struct
nl_cache *,
91
struct
nl_dump_params
*,
92
struct
nl_object *);
93
94
/* Iterators */
95
extern
void
nl_cache_foreach
(
struct
nl_cache *,
96
void
(*cb)(
struct
nl_object *,
97
void
*),
98
void
*arg);
99
extern
void
nl_cache_foreach_filter
(
struct
nl_cache *,
100
struct
nl_object *,
101
void
(*cb)(
struct
102
nl_object *,
103
void
*),
104
void
*arg);
105
106
/* --- cache management --- */
107
108
/* Cache type management */
109
extern
struct
nl_cache_ops *
nl_cache_ops_lookup
(
const
char
*);
110
extern
struct
nl_cache_ops *
nl_cache_ops_lookup_safe
(
const
char
*);
111
extern
struct
nl_cache_ops *
nl_cache_ops_associate
(
int
,
int
);
112
extern
struct
nl_cache_ops *
nl_cache_ops_associate_safe
(
int
,
int
);
113
extern
struct
nl_msgtype *
nl_msgtype_lookup
(
struct
nl_cache_ops *,
int
);
114
extern
void
nl_cache_ops_foreach
(
void
(*cb)(
struct
nl_cache_ops *,
void
*),
void
*);
115
extern
int
nl_cache_mngt_register
(
struct
nl_cache_ops *);
116
extern
int
nl_cache_mngt_unregister
(
struct
nl_cache_ops *);
117
118
/* Global cache provisioning/requiring */
119
extern
void
nl_cache_mngt_provide
(
struct
nl_cache *);
120
extern
void
nl_cache_mngt_unprovide
(
struct
nl_cache *);
121
extern
struct
nl_cache *
nl_cache_mngt_require
(
const
char
*);
122
extern
struct
nl_cache *
nl_cache_mngt_require_safe
(
const
char
*);
123
extern
struct
nl_cache * __nl_cache_mngt_require(
const
char
*);
124
125
struct
nl_cache_mngr;
126
127
#define NL_AUTO_PROVIDE 1
128
#define NL_ALLOCATED_SOCK 2
/* For internal use only, do not use */
129
130
extern
int
nl_cache_mngr_alloc
(
struct
nl_sock *,
131
int
,
int
,
132
struct
nl_cache_mngr **);
133
extern
int
nl_cache_mngr_add
(
struct
nl_cache_mngr *,
134
const
char
*,
135
change_func_t,
136
void
*,
137
struct
nl_cache **);
138
extern
int
nl_cache_mngr_add_cache
(
struct
nl_cache_mngr *mngr,
139
struct
nl_cache *cache,
140
change_func_t cb,
void
*data);
141
extern
int
nl_cache_mngr_get_fd
(
struct
nl_cache_mngr *);
142
extern
int
nl_cache_mngr_poll
(
struct
nl_cache_mngr *,
143
int
);
144
extern
int
nl_cache_mngr_data_ready
(
struct
nl_cache_mngr *);
145
extern
void
nl_cache_mngr_info
(
struct
nl_cache_mngr *,
146
struct
nl_dump_params
*);
147
extern
void
nl_cache_mngr_free
(
struct
nl_cache_mngr *);
148
149
#ifdef __cplusplus
150
}
151
#endif
152
153
#endif
include
netlink
cache.h
Generated on Thu Jan 24 2013 14:39:29 for libnl by
1.8.1.1