X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Flib%2Flibcoap-4.1.1%2Fresource.c;h=4909dbedf88297726fbfdcb3a4e45727143b394d;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=3af2f0c1338637c1518881b7d439740c7ea06a3d;hpb=15369e5c03818f3cbc6f4084e729aae089ea94ef;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/lib/libcoap-4.1.1/resource.c b/resource/csdk/connectivity/lib/libcoap-4.1.1/resource.c index 3af2f0c..4909dbe 100644 --- a/resource/csdk/connectivity/lib/libcoap-4.1.1/resource.c +++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/resource.c @@ -6,19 +6,19 @@ * README for terms of use. */ -#include "config.h" -#include "net.h" -#include "debug.h" -#include "resource.h" -#include "subscribe.h" +#include "include/coap/config.h" +#include "include/coap/net.h" +#include "include/coap/debug.h" +#include "include/coap/resource.h" +#include "include/coap/subscribe.h" #ifdef WITH_LWIP -#include "utlist.h" +#include "include/coap/utlist.h" /* mem.h is only needed for the string free calls for * COAP_ATTR_FLAGS_RELEASE_NAME / COAP_ATTR_FLAGS_RELEASE_VALUE / * COAP_RESOURCE_FLAGS_RELEASE_URI. not sure what those lines should actually * do on lwip. */ -#include "mem.h" +#include "include/coap/mem.h" #include @@ -28,8 +28,8 @@ #endif #if defined(WITH_POSIX) || defined(WITH_ARDUINO) || defined(_WIN32) -#include "utlist.h" -#include "mem.h" +#include "include/coap/utlist.h" +#include "include/coap/mem.h" #define COAP_MALLOC_TYPE(Type) \ ((coap_##Type##_t *)coap_malloc(sizeof(coap_##Type##_t))) @@ -105,7 +105,7 @@ coap_free_subscription(coap_subscription_t *subscription) } \ } -int match(const str *text, const str *pattern, int match_prefix, int match_substring) +static int match(const str *text, const str *pattern, int match_prefix, int match_substring) { assert(text); assert(pattern); @@ -471,7 +471,7 @@ void coap_hash_request_uri(const coap_pdu_t *request, coap_key_t key) coap_option_filter_clear(filter); coap_option_setb(filter, COAP_OPTION_URI_PATH); - coap_option_iterator_init((coap_pdu_t *) request, &opt_iter, filter, coap_udp); + coap_option_iterator_init((coap_pdu_t *) request, &opt_iter, filter); while ((option = coap_option_next(&opt_iter))) coap_hash(COAP_OPT_VALUE(option), COAP_OPT_LENGTH(option), key); } @@ -766,7 +766,7 @@ static void coap_notify_observers(coap_context_t *context, coap_resource_t *r) coap_tid_t tid = COAP_INVALID_TID; obs->dirty = 0; /* initialize response */ - response = coap_pdu_init(COAP_MESSAGE_CON, 0, 0, COAP_MAX_PDU_SIZE, coap_udp); + response = coap_pdu_init(COAP_MESSAGE_CON, 0, 0, COAP_MAX_PDU_SIZE); if (!response) { obs->dirty = 1; @@ -775,7 +775,7 @@ static void coap_notify_observers(coap_context_t *context, coap_resource_t *r) continue; } - if (!coap_add_token(response, obs->token_length, obs->token, coap_udp)) + if (!coap_add_token(response, obs->token_length, obs->token)) { obs->dirty = 1; r->partiallydirty = 1; @@ -787,19 +787,19 @@ static void coap_notify_observers(coap_context_t *context, coap_resource_t *r) token.length = obs->token_length; token.s = obs->token; - response->hdr->coap_hdr_udp_t.id = coap_new_message_id(context); + response->transport_hdr->udp.id = coap_new_message_id(context); if (obs->non && obs->non_cnt < COAP_OBS_MAX_NON) { - response->hdr->coap_hdr_udp_t.type = COAP_MESSAGE_NON; + response->transport_hdr->udp.type = COAP_MESSAGE_NON; } else { - response->hdr->coap_hdr_udp_t.type = COAP_MESSAGE_CON; + response->transport_hdr->udp.type = COAP_MESSAGE_CON; } /* fill with observer-specific data */ h(context, r, &obs->subscriber, NULL, &token, response); - if (response->hdr->coap_hdr_udp_t.type == COAP_MESSAGE_CON) + if (response->transport_hdr->udp.type == COAP_MESSAGE_CON) { tid = coap_send_confirmed(context, &obs->subscriber, response); obs->non_cnt = 0; @@ -810,7 +810,7 @@ static void coap_notify_observers(coap_context_t *context, coap_resource_t *r) obs->non_cnt++; } - if (COAP_INVALID_TID == tid || response->hdr->coap_hdr_udp_t.type != COAP_MESSAGE_CON) + if (COAP_INVALID_TID == tid || response->transport_hdr->udp.type != COAP_MESSAGE_CON) coap_delete_pdu(response); if (COAP_INVALID_TID == tid) {