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

Pass along resource CoAP_Res_t as a member of CoAP_Message_t #23

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/coap_interaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ CoAP_Result_t _rom CoAP_StartNewServerInteraction(CoAP_Message_t* pMsgReq, CoAP_
NetEp_t* pReqEp = &(pPacket->remoteEp);
CoAP_Interaction_t* pIA;

//Set the CoAP resource to the requst message
pMsgReq->pResource = pRes;

//duplicate detection:
//same request already received before?
//iterate over all interactions
Expand Down
5 changes: 5 additions & 0 deletions src/liblobaro_coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ typedef struct {
uint8_t Token[8];
} CoAP_Token_t;

// Delcare CoAP_Res so it can be used in CoAP_Message_t
struct CoAP_Res;

typedef struct {
uint32_t Timestamp; //set by parse/send network routines
//VER is implicit = 1
Expand All @@ -248,6 +251,8 @@ typedef struct {
CoAP_Token_t Token; // [9] Token (1 byte Length + up to 8 Byte for the token content)
CoAP_option_t* pOptionsList; // [4] linked list of Options
uint8_t* Payload; // [4] MUST be last in struct! Because of mem allocation scheme which tries to allocate message mem and payload mem in ONE big data chunk

struct CoAP_Res* pResource; // Pointer the the resource this message is intended for.
} CoAP_Message_t; //total of 25 Bytes

//################################
Expand Down