cn-uofbasel / ccn-lite

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

removes source file includes in ccnl-utils #270

Closed mfrey closed 6 years ago

mfrey commented 6 years ago

Contribution description

This PR restructures the ccnl-utils module and introduces a include and src directory. The C-file includes have been split into a header and source file. Hence, all occurrences of e.g.

#include "ccnl-common.c"

have been replaced by

#include "ccnl-common.h"

These changes also required some customizations in the CMakeLists.txt file of the module. It also removes the USE_SIGNATURES use flag since ISO C forbids empty translation units (which was a result of splitting ccnl-crypto.c into ccnl-crypto.{h,c})

Issues/PRs references

Fixes #236

mfrey commented 6 years ago

For the sake of transparency - I've missed to split ccnl-ext-hmac.c into ccnl-ext-hmac.{h,c}. This would require to remove the USE_HMAC256 use flag (like I've did for USE_SIGNATURES) since ISO C forbids empty translation unit. Before I do so, I would leave this up for discussion and get some feedback if that's the smartest choice.

mfrey commented 6 years ago

Before I do so, I would leave this up for discussion and get some feedback if that's the smartest choice.

Okay. I've seperated the source into a header and source of ccnl-ext-hmac.c and lib-sha256.c - There should be no issue with empty translation units.

mfrey commented 6 years ago

Minor point: add documentation to hmac? would this be useful?

Will do and update the PR

mfrey commented 6 years ago

Minor point: add documentation to hmac? would this be useful?

I've tried my best, but there are some gaps to fill. Particularly, the offset parameter in the packet crafting functions of ccnl-ext-mac.c is hard to understand (given the fact that there are so many other offset/position parameters).