1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/ccn_lite/ccnl-ext.h

99 lines
3.4 KiB
C
Raw Normal View History

2013-10-28 10:25:17 +01:00
/*
* @f ccnl-ext.h
* @b header file for CCN lite extentions (forward declarations)
*
* Copyright (C) 2011-13, Christian Tschudin, University of Basel
* Copyright (C) 2013, Christian Mehlis, Freie Universität Berlin
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* File history:
* 2013-03-30 created
*/
// ----------------------------------------------------------------------
#ifndef CCNL_EXT_H__
#define CCNL_EXT_H__
2013-12-20 18:43:43 +01:00
#define compute_ccnx_digest(buf) sha256(buf->data, buf->datalen, NULL)
2013-10-28 10:25:17 +01:00
#ifdef USE_FRAG
struct ccnl_frag_s *ccnl_frag_new(int protocol, int mtu);
void ccnl_frag_reset(struct ccnl_frag_s *e, struct ccnl_buf_s *buf,
int ifndx, sockunion *su);
int ccnl_frag_getfragcount(struct ccnl_frag_s *e, int origlen,
int *totallen);
struct ccnl_buf_s *ccnl_frag_getnext(struct ccnl_frag_s *e,
int *ifndx, sockunion *su);
/*
struct ccnl_buf_s* ccnl_frag_handle_fragment(struct ccnl_relay_s *r,
struct ccnl_face_s *f, unsigned char *data, int datalen);
2013-10-28 10:25:17 +01:00
*/
void ccnl_frag_destroy(struct ccnl_frag_s *e);
/*
struct ccnl_buf_s* ccnl_frag_fragment(struct ccnl_relay_s *ccnl,
struct ccnl_frag_s *frag,
struct ccnl_buf_s *buf);
2013-10-28 10:25:17 +01:00
*/
typedef int (RX_datagram)(struct ccnl_relay_s *, struct ccnl_face_s *,
unsigned char **, int *);
int ccnl_frag_RX_frag2012(RX_datagram callback, struct ccnl_relay_s *relay,
struct ccnl_face_s *from,
unsigned char **data, int *datalen);
int ccnl_frag_RX_CCNx2013(RX_datagram callback, struct ccnl_relay_s *relay,
struct ccnl_face_s *from,
unsigned char **data, int *datalen);
int ccnl_is_fragment(unsigned char *data, int datalen);
#else
# define ccnl_frag_new(e,u) NULL
# define ccnl_frag_destroy(e) do{}while(0)
# define ccnl_frag_handle_fragment(r,f,data,len) ccnl_buf_new(data,len)
# define ccnl_is_fragment(d,l) 0
#endif // USE_FRAG
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
int ccnl_mgmt(struct ccnl_relay_s *ccnl, struct ccnl_buf_s *buf,
struct ccnl_prefix_s *prefix, struct ccnl_face_s *from);
2013-11-29 22:42:56 +01:00
struct ccnl_prefix_s *
ccnl_prefix_clone(struct ccnl_prefix_s *p);
struct ccnl_prefix_s *
ccnl_prefix_clone_strip(struct ccnl_prefix_s *p, int strip);
2013-10-28 10:25:17 +01:00
// ----------------------------------------------------------------------
# define ccnl_sched_CTS_done(S,C,L) do{}while(0)
# define ccnl_sched_destroy(S) do{}while(0)
2013-10-28 10:25:17 +01:00
char *ccnl_prefix_to_path(struct ccnl_prefix_s *pr);
#endif /* CCNL_EXT_H__ */
// eof