ndn-lite
pit.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2019 Zhiyi Zhang, Xinyu Ma
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v3.0. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #ifndef FORWARDER_PIT_H_
10 #define FORWARDER_PIT_H_
11 #include "../encode/forwarder-helper.h"
12 #include "../util/bit-operations.h"
13 #include "face.h"
14 #include "name-tree.h"
15 #include "callback-funcs.h"
16 #include "../util/uniform-time.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
31 typedef struct ndn_pit_entry {
35 
39  uint64_t incoming_faces;
40 
44  uint64_t outgoing_faces;
45 
49 
54 
58 
62 
65  void* userdata;
66 
72 
76 typedef struct ndn_pit{
80 }ndn_pit_t;
81 
82 #define NDN_PIT_RESERVE_SIZE(entry_count) \
83  (sizeof(ndn_pit_t) + sizeof(ndn_pit_entry_t) * (entry_count))
84 
85 void
86 ndn_pit_init(void* memory, ndn_table_id_t capacity, ndn_nametree_t* nametree);
87 
88 void
90 
92 ndn_pit_find_or_insert(ndn_pit_t* self, uint8_t* name, size_t length);
93 
95 ndn_pit_find(ndn_pit_t* self, uint8_t* prefix, size_t length);
96 
98 ndn_pit_prefix_match(ndn_pit_t* self, uint8_t* prefix, size_t length);
99 
100 void
102 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif // FORWARDER_PIT_H
void(* ndn_on_data_func)(const uint8_t *data, uint32_t data_size, void *userdata)
The onData callback function.
Definition: callback-funcs.h:34
PIT entry.
Definition: pit.h:31
ndn_pit_entry_t * ndn_pit_prefix_match(ndn_pit_t *self, uint8_t *prefix, size_t length)
Definition: pit.c:136
ndn_nametree_t * nametree
Definition: pit.h:77
interest_options_t options
Interest Options.
Definition: pit.h:34
ndn_pit_entry_t slots[]
Definition: pit.h:79
ndn_on_data_func on_data
OnData callback if the application expressed this Interest.
Definition: pit.h:57
uint64_t incoming_faces
Faces received this Interest.
Definition: pit.h:39
void ndn_pit_unregister_face(ndn_pit_t *self, ndn_table_id_t face_id)
Definition: pit.c:90
Forwarding Information Base (FIB).
Definition: pit.h:76
struct ndn_pit ndn_pit_t
Forwarding Information Base (FIB).
struct ndn_pit_entry ndn_pit_entry_t
PIT entry.
ndn_table_id_t nametree_id
NameTree entry's ID.
Definition: pit.h:70
ndn_pit_entry_t * ndn_pit_find_or_insert(ndn_pit_t *self, uint8_t *name, size_t length)
Definition: pit.c:111
ndn_on_timeout_func on_timeout
OnTimeout callback if the application expressed this Interest.
Definition: pit.h:61
ndn_time_ms_t last_time
Timestamp for last time the forwarder received this Interest.
Definition: pit.h:48
Definition: name-splay.h:38
void * userdata
User defined data.
Definition: pit.h:65
ndn_table_id_t capacity
Definition: pit.h:78
void ndn_pit_init(void *memory, ndn_table_id_t capacity, ndn_nametree_t *nametree)
Definition: pit.c:57
void(* ndn_on_timeout_func)(void *userdata)
The onTimeout callback function.
Definition: callback-funcs.h:40
uint64_t outgoing_faces
Faces sent out this Interest.
Definition: pit.h:44
uint64_t ndn_time_ms_t
Time count in milli-seconds.
Definition: uniform-time.h:29
uint16_t ndn_table_id_t
Definition: ndn-constants.h:39
ndn_time_ms_t express_time
Timestamp when the application expressed this Interest.
Definition: pit.h:53
Interest options which the forwarder cares.
Definition: forwarder-helper.h:34
ndn_pit_entry_t * ndn_pit_find(ndn_pit_t *self, uint8_t *prefix, size_t length)
Definition: pit.c:126
void ndn_pit_remove_entry(ndn_pit_t *self, ndn_pit_entry_t *entry)
Definition: pit.c:71