1 | #ifndef MODULE_CACHEEX_H_
|
---|
2 | #define MODULE_CACHEEX_H_
|
---|
3 |
|
---|
4 | static inline uint64_t cacheex_node_id(void *var) { uint64_t *x = var; return *x; }
|
---|
5 |
|
---|
6 | extern uint8_t cacheex_peer_id[8];
|
---|
7 |
|
---|
8 | extern int32_t cacheex_add_stats(struct s_client *cl, uint16_t caid, uint16_t srvid, uint32_t prid, uint8_t direction);
|
---|
9 | extern int8_t cacheex_maxhop(struct s_client *cl);
|
---|
10 | void cacheex_cache_push(ECM_REQUEST *er);
|
---|
11 | extern inline int8_t cacheex_match_alias(struct s_client *cl, ECM_REQUEST *er, ECM_REQUEST *ecm);
|
---|
12 | extern void cacheex_add_to_cache(struct s_client *cl, ECM_REQUEST *er);
|
---|
13 | extern void cacheex_add_to_cache_from_csp(struct s_client *cl, ECM_REQUEST *er);
|
---|
14 | #ifdef CS_CACHEEX
|
---|
15 | extern void cacheex_init(void);
|
---|
16 | extern void cacheex_clear_account_stats(struct s_auth *account);
|
---|
17 | extern void cacheex_clear_client_stats(struct s_client *client);
|
---|
18 | extern void cacheex_load_config_file(void);
|
---|
19 | extern void cacheex_update_hash(ECM_REQUEST *er);
|
---|
20 | static inline bool cacheex_reader(struct s_reader *rdr) { return rdr->cacheex.mode == 1; };
|
---|
21 | extern bool cacheex_is_match_alias(struct s_client *cl, ECM_REQUEST *er);
|
---|
22 | static inline void cacheex_set_csp_lastnode(ECM_REQUEST *er)
|
---|
23 | {
|
---|
24 | er->csp_lastnodes = NULL;
|
---|
25 | }
|
---|
26 | static inline void cacheex_free_csp_lastnodes(ECM_REQUEST *er)
|
---|
27 | {
|
---|
28 | LLIST *l = er->csp_lastnodes;
|
---|
29 | er->csp_lastnodes = NULL;
|
---|
30 | ll_destroy_data(l);
|
---|
31 | }
|
---|
32 | static inline void cacheex_set_cacheex_src(ECM_REQUEST *ecm, struct s_client *cl)
|
---|
33 | {
|
---|
34 | if (ecm->cacheex_src == cl)
|
---|
35 | ecm->cacheex_src = NULL;
|
---|
36 | }
|
---|
37 | static inline void cacheex_init_cacheex_src(ECM_REQUEST *ecm, ECM_REQUEST *er)
|
---|
38 | {
|
---|
39 | if (!ecm->cacheex_src)
|
---|
40 | ecm->cacheex_src = er->cacheex_src;
|
---|
41 | }
|
---|
42 | /**
|
---|
43 | * Check for NULL ecmd5
|
---|
44 | **/
|
---|
45 | static inline uint8_t checkECMD5(ECM_REQUEST *er)
|
---|
46 | {
|
---|
47 | int8_t i;
|
---|
48 | for (i=0;i<CS_ECMSTORESIZE;i++)
|
---|
49 | if (er->ecmd5[i]) return 1;
|
---|
50 | return 0;
|
---|
51 | }
|
---|
52 | void add_hitcache(struct s_client *cl, ECM_REQUEST *er, ECM_REQUEST *ecm);
|
---|
53 | struct csp_ce_hit_t *check_hitcache(ECM_REQUEST *er, struct s_client *cl, uint8_t lock);
|
---|
54 | void cleanup_hitcache(void);
|
---|
55 | uint32_t get_cacheex_wait_time(ECM_REQUEST *er, struct s_client *cl);
|
---|
56 | int32_t chk_csp_ctab(ECM_REQUEST *er, CECSPVALUETAB *tab);
|
---|
57 | uint8_t check_cacheex_filter(struct s_client *cl, ECM_REQUEST *er);
|
---|
58 | #else
|
---|
59 | static inline void cacheex_init(void) { };
|
---|
60 | static inline void cacheex_clear_account_stats(struct s_auth *UNUSED(account)) { };
|
---|
61 | static inline void cacheex_clear_client_stats(struct s_client *UNUSED(client)) { };
|
---|
62 | static inline void cacheex_load_config_file(void) { };
|
---|
63 | static inline void cacheex_update_hash(ECM_REQUEST *UNUSED(er)) { };
|
---|
64 | static inline bool cacheex_reader(struct s_reader *UNUSED(rdr)) { return false; };
|
---|
65 | static inline bool cacheex_is_match_alias(struct s_client *UNUSED(cl), ECM_REQUEST *UNUSED(er)) { return false; }
|
---|
66 | static inline void cacheex_set_csp_lastnode(ECM_REQUEST *UNUSED(er)) { }
|
---|
67 | static inline void cacheex_free_csp_lastnodes(ECM_REQUEST *UNUSED(er)) { }
|
---|
68 | static inline void cacheex_set_cacheex_src(ECM_REQUEST *UNUSED(ecm), struct s_client *UNUSED(cl)) { }
|
---|
69 | static inline void cacheex_init_cacheex_src(ECM_REQUEST *UNUSED(ecm), ECM_REQUEST *UNUSED(er)) { }
|
---|
70 | static inline void cleanup_hitcache(void){ }
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | #endif
|
---|