Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduces null checks for functions in ccnl-interest.c/refactoring #307

Merged
merged 7 commits into from
Oct 18, 2018

Conversation

mfrey
Copy link
Collaborator

@mfrey mfrey commented Oct 17, 2018

Contribution description

The PR introduces NULL checks for functions ccnl_interest_isSame and ccnl_interest_remove_pending, and ccnl_interest_append_pending in ccnl-interest.c and the corresponding unit tests (for now just the failing functions). It also removes dead code from ccnl-interests.c (a function called ccnl_interest_new) and moves a function ccnl_interest_new from ccnl-relay.c.

Issues/PRs references

None

The commit removes dead code from ccnl-interest.c namely a function
with the following defintion:

  struct ccnl_interest_s*
    ccnl_interest_new(struct ccnl_face_s *from, struct ccnl_pkt_s **pkt)

and moves a function with the name, but different parameters from
ccnl-relay.c to ccnl-interest.h. The definition is as follows

  struct ccnl_interest_s*
    ccnl_interest_new(struct ccnl_relay_s *ccnl, struct ccnl_face_s *from,
       struct ccnl_pkt_s **pkt);
@mfrey mfrey added minor requires squashing commits need to be squashed before merge labels Oct 17, 2018
@mfrey
Copy link
Collaborator Author

mfrey commented Oct 17, 2018

I'm note sure about moving ccnl_interest_new from ccnl-relay.c to ccnl_interest.c since the function operates on a data structure adherent to ccnl-relay. Maybe we should make new functions which are called in ccnl-relay.c and remove the "raw operation" on the data structure. However, this solution would introduce a new level of indirection and not really solve the "issue".

blacksheeep
blacksheeep previously approved these changes Oct 17, 2018
Copy link
Contributor

@blacksheeep blacksheeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

*/
struct ccnl_pendint_s {
struct ccnl_pendint_s *next; /**< pointer to the next list element */
struct ccnl_face_s *face; /** */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointer to incoming face

unsigned short flags; /**< ? */
uint32_t lifetime; /**< interest lifetime */
uint32_t last_used; /**< last time the entry was used */
int retries; /**< ? */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current number of executed retransmits.

#endif
};


/**
* ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creates a new ccnl_interest_s object

* @param[in] from
* @param[in] pkt
*
* @return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal data structure representing an interest object

struct ccnl_face_s *face;
uint32_t last_used;
/**
* ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This defines a flag. If set the ccn-lite forwarder should forward/retransmit a packet, otherwise it will be internally.

struct ccnl_pkt_s *pkt; /**< the packet the interests originates from (?) */
struct ccnl_face_s *from; /**< the face the interest was received from */
struct ccnl_pendint_s *pending; /**< linked list of faces wanting that content */
unsigned short flags; /**< ? */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flags defined for the active interest object. A flag can define, define, if an interest is forwarded or should be handeld internally (forwarded if last bit is set).

Note: This field was previously used to mark an interest as "NFN-Interest" or "R2C-NFN-Interest". Since this is not required anymore, and "internal interests" were also used by NFN we can discuss the usage of this field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But don't we still distinguish interests which are forwarded and interests which are actually handled by the forwarder (e.g. creating/delivering content)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so we keep it for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay flags is only used in ccnl_interest_new in ccnl-interest.c and in ccnl_mkInterestObject in ccnl-pkt-builder.c. It doesn't seem to be evaluated anywhere. So it is safe to remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically just commented out flags and checked where it would fail to compile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i think it is safe to remove

Copy link
Collaborator Author

@mfrey mfrey Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll make a seperate PR

@mfrey mfrey merged commit 06a1c4a into cn-uofbasel:master Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor requires squashing commits need to be squashed before merge
Projects
Improve the Code Quality
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants