-
Notifications
You must be signed in to change notification settings - Fork 8
/
cs.h
73 lines (62 loc) · 1.5 KB
/
cs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Copyright (C) 2016 Wentao Shang
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup net_ndn NDN packet processing
* @ingroup net
* @brief NDN packet sending and receiving.
* @{
*
* @file
* @brief NDN content store implementation.
*
* @author Wentao Shang <wentaoshang@gmail.com>
*/
#ifndef NDN_CS_H_
#define NDN_CS_H_
#include "encoding/shared-block.h"
#include <kernel_types.h>
//#include <xtimer.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ndn_cs_entry {
struct ndn_cs_entry *prev;
struct ndn_cs_entry *next;
ndn_shared_block_t *data;
//TODO: add freshness timer
} ndn_cs_entry_t;
/**
* @brief Adds a data block to the CS.
* @details Will make a copy of the shared block.
*
* @oaram[in] data Data block to add.
*
* @return 0, if success.
* @return -1, if out of memory.
*/
int ndn_cs_add(ndn_shared_block_t* data);
/**
* @brief Macthes interest in the CS.
*
* @param[in] interest Interest block to match.
*
* @return Shared pointer to the data block. Caller is responsible for
* releasing the pointer.
* @return NULL, if no match is found.
* @retrun NULL, if @p interest is invalid.
*/
ndn_shared_block_t* ndn_cs_match(ndn_block_t* interest);
/**
* @brief Initializes the content store.
*/
void ndn_cs_init(void);
#ifdef __cplusplus
}
#endif
#endif /* NDN_CS_H_ */
/** @} */