cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

redundant information in ccnl_pkt_s and ccnl_content_s #304

Closed mfrey closed 5 years ago

mfrey commented 5 years ago

The definition of struct ccnl_content.h contains a member freshnessperiod

 53 struct ccnl_content_s {
 ...
 64 #ifdef USE_SUITE_NDNTLV
 65     uint32_t freshnessperiod;             
 66     bool stale;                          
 67 #endif
...

However, the freshnessperiod seems also to be defined in ccnl_packet.h, e.g.

 75 struct ccnl_pktdetail_ndntlv_s {
 ...
 81     /* Data */
 82     uint32_t freshnessperiod;      
 83 };
 ...
 85 struct ccnl_pkt_s {
 86     struct ccnl_buf_s *buf;       
 87     struct ccnl_prefix_s *pfx;     
 ...
 95     union {
 96         struct ccnl_pktdetail_ccnb_s   ccnb;
 97         struct ccnl_pktdetail_ccntlv_s ccntlv;
 98         struct ccnl_pktdetail_ndntlv_s ndntlv;
 99     } s
 ...

This seems a bit too redundant too me, but maybe I'm missing the point?

mfrey commented 5 years ago

The member freshnessperiod of the struct ccnl_content_s seems to be set in ccnl_content_new but is never used throughout the code?

mfrey commented 5 years ago

The member last_used of struct ccnl_content_s seems to handle the staleness/non-stale indication of data packets.

 740  if ((c->last_used + (c->pkt->s.ndntlv.freshnessperiod / 1000)) <= (uint32_t) t) {
blacksheeep commented 5 years ago

If unsused, I think the field can be removed.