@@ -105,6 +105,22 @@ extern "C" {
105
105
* @}
106
106
*/
107
107
108
+ /**
109
+ * @brief Some macro definitions
110
+ * @{
111
+ */
112
+ #define free_2ptr_list (a ,b ) ccnl_free(a), ccnl_free(b)
113
+ #define free_3ptr_list (a ,b ,c ) ccnl_free(a), ccnl_free(b), ccnl_free(c)
114
+ #define free_4ptr_list (a ,b ,c ,d ) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d);
115
+ #define free_5ptr_list (a ,b ,c ,d ,e ) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d), ccnl_free(e);
116
+
117
+ /**
118
+ * Frees all memory directly and indirectly allocated for prefix information
119
+ */
120
+ #define free_prefix (p ) do{ if(p) \
121
+ free_5ptr_list(p->bytes,p->comp,p->complen,p->chunknum,p); } while(0)
122
+
123
+
108
124
/**
109
125
* Constant string
110
126
*/
@@ -123,7 +139,7 @@ extern "C" {
123
139
/**
124
140
* Struct holding CCN-Lite's central relay information
125
141
*/
126
- extern struct ccnl_relay_s theRelay ;
142
+ extern struct ccnl_relay_s ccnl_relay ;
127
143
128
144
/**
129
145
* @brief Start the main CCN-Lite event-loop
@@ -149,26 +165,43 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
149
165
*
150
166
* @param[in] suite CCN packet format
151
167
* @param[in] name The name that is requested
152
- * @param[in] addr The relay's address to send to
153
- * @param[in] addr_len Length of @p addr
154
168
* @param[in] chunknum Number of the requested content chunk
155
169
* @param[out] buf Buffer to write the content chunk to
156
170
* @param[in] buf_len Size of @p buf
157
171
*
158
172
* @return 0 on successfully sent Interest
159
173
* @return -1 if Interested couldn't be sent
160
174
*/
161
- int ccnl_send_interest (int suite , char * name , uint8_t * addr , size_t addr_len ,
162
- unsigned int * chunknum , unsigned char * buf ,
163
- size_t buf_len );
175
+ int ccnl_send_interest (int suite , char * name , unsigned int * chunknum ,
176
+ unsigned char * buf , size_t buf_len );
164
177
165
178
/**
166
179
* @brief Waits for incoming content chunk
167
180
*
168
181
* @return 0 if a content was received
169
182
* @return -ETIMEDOUT if no chunk was received until timeout
170
183
*/
171
- int ccnl_wait_for_chunk (void * buf , size_t buf_len );
184
+ int ccnl_wait_for_chunk (void * buf , size_t buf_len , uint64_t timeout );
185
+
186
+ /**
187
+ * @brief Add entry to the CCN-Lite FIB
188
+ *
189
+ * @par[in] relay Local relay struct
190
+ * @par[in] pfx Prefix of the FIB entry
191
+ * @par[in] face Face for the FIB entry
192
+ *
193
+ * @return 0 on success
194
+ * @return -1 on error
195
+ */
196
+ int ccnl_fib_add_entry (struct ccnl_relay_s * relay , struct ccnl_prefix_s * pfx ,
197
+ struct ccnl_face_s * face );
198
+
199
+ /**
200
+ * @brief Prints the current CCN-Lite FIB
201
+ *
202
+ * @par[in] relay Local relay struct
203
+ */
204
+ void ccnl_fib_show (struct ccnl_relay_s * relay );
172
205
173
206
#ifdef __cplusplus
174
207
}
0 commit comments