17 #include <netlink-local.h>
18 #include <netlink/netlink.h>
19 #include <netlink/cache.h>
20 #include <netlink/utils.h>
40 for (ops = cache_ops; ops; ops = ops->co_next)
41 if (!strcmp(ops->co_name, name))
63 for (ops = cache_ops; ops; ops = ops->co_next)
64 for (i = 0; ops->co_msgtypes[i].
mt_id >= 0; i++)
65 if (ops->co_msgtypes[i].
mt_id == msgtype &&
66 ops->co_protocol == protocol)
86 for (i = 0; ops->co_msgtypes[i].
mt_id >= 0; i++)
87 if (ops->co_msgtypes[i].
mt_id == msgtype)
88 return &ops->co_msgtypes[i];
97 for (ops = cache_ops; ops; ops = ops->co_next)
98 if (ops->co_obj_ops == obj_ops)
114 for (ops = cache_ops; ops; ops = ops->co_next)
130 return nl_error(EINVAL,
"No cache name specified");
132 if (!ops->co_obj_ops)
133 return nl_error(EINVAL,
"No obj cache ops specified");
136 return nl_error(EEXIST,
"Cache operations already exist");
138 ops->co_next = cache_ops;
141 NL_DBG(1,
"Registered cache operations %s\n", ops->co_name);
161 for (tp = &cache_ops; (t=*tp) != NULL; tp = &t->co_next)
166 return nl_error(ENOENT,
"No such cache operations");
168 NL_DBG(1,
"Unregistered cache operations %s\n", ops->co_name);
193 ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
197 ops->co_major_cache = cache;
212 ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
215 else if (ops->co_major_cache == cache)
216 ops->co_major_cache = NULL;
234 if (!ops || !ops->co_major_cache) {
235 fprintf(stderr,
"Application BUG: Your application must "
236 "call nl_cache_mngt_provide() and\nprovide a valid "
237 "%s cache to be used for internal lookups.\nSee the "
238 " API documentation for more details.\n", name);
243 return ops->co_major_cache;