netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cache.h File Reference
#include <stdint.h>
#include <stddef.h>
#include "hash.h"
#include "date.h"
Include dependency graph for cache.h:

Data Structures

struct  cache_object
 
struct  cache_feature
 
struct  cache
 
struct  cache_extra
 
struct  cache_ops
 
struct  __dump_container
 
struct  __commit_container
 

Macros

#define CACHE_MAX_FEATURE   __CACHE_MAX_FEATURE
 
#define CACHE_MAX_NAMELEN   32
 

Enumerations

enum  {
  NO_FEATURES = 0,
  TIMER_FEATURE = 0,
  TIMER = (1 << TIMER_FEATURE),
  __CACHE_MAX_FEATURE
}
 
enum  {
  C_OBJ_NONE = 0,
  C_OBJ_NEW,
  C_OBJ_ALIVE,
  C_OBJ_DEAD,
  C_OBJ_MAX
}
 
enum  cache_type {
  CACHE_T_NONE = 0,
  CACHE_T_CT,
  CACHE_T_EXP,
  CACHE_T_MAX
}
 

Functions

struct cachecache_create (const char *name, enum cache_type type, unsigned int features, struct cache_extra *extra, struct cache_ops *ops)
 
void cache_destroy (struct cache *e)
 
struct cache_objectcache_object_new (struct cache *c, void *ptr)
 
void cache_object_free (struct cache_object *obj)
 
void cache_object_get (struct cache_object *obj)
 
int cache_object_put (struct cache_object *obj)
 
void cache_object_set_status (struct cache_object *obj, int status)
 
int cache_add (struct cache *c, struct cache_object *obj, int id)
 
void cache_update (struct cache *c, struct cache_object *obj, int id, void *ptr)
 
struct cache_objectcache_update_force (struct cache *c, void *ptr)
 
void cache_del (struct cache *c, struct cache_object *obj)
 
struct cache_objectcache_find (struct cache *c, void *ptr, int *pos)
 
void cache_stats (const struct cache *c, int fd)
 
void cache_stats_extended (const struct cache *c, int fd)
 
void * cache_get_extra (struct cache_object *)
 
void cache_iterate (struct cache *c, void *data, int(*iterate)(void *data1, void *data2))
 
void cache_iterate_limit (struct cache *c, void *data, uint32_t from, uint32_t steps, int(*iterate)(void *data1, void *data2))
 
void cache_dump (struct cache *c, int fd, int type)
 
int cache_commit (struct cache *c, struct nfct_handle *h, int clientfd)
 
void cache_flush (struct cache *c)
 
void cache_bulk (struct cache *c)
 

Variables

struct cache_feature timer_feature
 
struct cache_ops cache_sync_internal_ct_ops
 
struct cache_ops cache_sync_external_ct_ops
 
struct cache_ops cache_stats_ct_ops
 
struct cache_ops cache_sync_internal_exp_ops
 
struct cache_ops cache_sync_external_exp_ops
 

Macro Definition Documentation

#define CACHE_MAX_FEATURE   __CACHE_MAX_FEATURE

Referenced by cache_create().

#define CACHE_MAX_NAMELEN   32

Enumeration Type Documentation

anonymous enum
Enumerator
NO_FEATURES 
TIMER_FEATURE 
TIMER 
__CACHE_MAX_FEATURE 
anonymous enum
Enumerator
C_OBJ_NONE 
C_OBJ_NEW 
C_OBJ_ALIVE 
C_OBJ_DEAD 
C_OBJ_MAX 
enum cache_type
Enumerator
CACHE_T_NONE 
CACHE_T_CT 
CACHE_T_EXP 
CACHE_T_MAX 

Function Documentation

int cache_add ( struct cache c,
struct cache_object obj,
int  id 
)

References cache::add_fail, cache::add_fail_enospc, cache::add_ok, and cache::stats.

Referenced by cache_update_force().

Here is the caller graph for this function:

void cache_bulk ( struct cache c)
int cache_commit ( struct cache c,
struct nfct_handle h,
int  clientfd 
)

References cache_ops::commit, and cache::ops.

void cache_del ( struct cache c,
struct cache_object obj 
)

References cache::active, C_OBJ_DEAD, cache::del_ok, cache::stats, and cache_object::status.

Referenced by cache_object_put(), and cache_update_force().

Here is the caller graph for this function:

void cache_destroy ( struct cache e)

References cache_flush(), cache::feature_offset, cache::features, cache::h, and hashtable_destroy().

Here is the call graph for this function:

void cache_dump ( struct cache c,
int  fd,
int  type 
)

References cache_ops::dump_step, __dump_container::fd, cache::h, hashtable_iterate(), and cache::ops.

Here is the call graph for this function:

struct cache_object* cache_find ( struct cache c,
void *  ptr,
int *  pos 
)

References cache::h, hashtable_find(), and hashtable_hash().

Referenced by cache_update_force().

Here is the call graph for this function:

Here is the caller graph for this function:

void cache_flush ( struct cache c)

References cache::flush, cache::h, hashtable_iterate(), and cache::stats.

Referenced by cache_destroy().

Here is the call graph for this function:

Here is the caller graph for this function:

void* cache_get_extra ( struct cache_object )
void cache_iterate ( struct cache c,
void *  data,
int(*)(void *data1, void *data2)  iterate 
)

References cache::h, and hashtable_iterate().

Here is the call graph for this function:

void cache_iterate_limit ( struct cache c,
void *  data,
uint32_t  from,
uint32_t  steps,
int(*)(void *data1, void *data2)  iterate 
)

References cache::h, and hashtable_iterate_limit().

Here is the call graph for this function:

void cache_object_free ( struct cache_object obj)

References cache_object::cache, cache_ops::free, cache::objects, cache::ops, cache_object::ptr, and cache::stats.

Referenced by cache_object_put(), and cache_update_force().

Here is the caller graph for this function:

void cache_object_get ( struct cache_object obj)

References cache_object::refcnt.

int cache_object_put ( struct cache_object obj)

References cache_object::cache, cache_del(), cache_object_free(), and cache_object::refcnt.

Here is the call graph for this function:

void cache_object_set_status ( struct cache_object obj,
int  status 
)
struct cache_object* cache_update_force ( struct cache c,
void *  ptr 
)

Variable Documentation

struct cache_ops cache_stats_ct_ops
struct cache_ops cache_sync_external_ct_ops
struct cache_ops cache_sync_external_exp_ops
struct cache_ops cache_sync_internal_ct_ops
struct cache_ops cache_sync_internal_exp_ops
struct cache_feature timer_feature