Modifying version number for building on tizen 3.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caprotocolmessage.h
1 /******************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20 #ifndef __CA_PROTOCOL_MESSAGE_H_
21 #define __CA_PROTOCOL_MESSAGE_H_
22
23 #include "cacommon.h"
24 #include "config.h"
25 #include "coap.h"
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 uint32_t flags = 0;
33
34 uint8_t msgtype = COAP_MESSAGE_CON; /* usually, requests are sent confirmable */
35
36 coap_block_t block =
37 {   .num = 0, .m = 0, .szx = 6};
38
39 typedef uint32_t code_t;
40
41 /**
42  * function for generate
43  */
44 coap_pdu_t* CAGeneratePdu(const char* uri, const uint32_t code, const CAInfo_t info);
45 /**
46  * function for parsing
47  */
48 uint32_t CAGetRequestInfoFromPdu(const coap_pdu_t *pdu, CARequestInfo_t* outReqInfo);
49
50 uint32_t CAGetResponseInfoFromPdu(const coap_pdu_t *pdu, CAResponseInfo_t* outResInfo);
51
52 coap_pdu_t* CACreatePDUforRequest(const code_t code, coap_list_t *options);
53
54 coap_pdu_t* CACreatePDUforRequestWithPayload(const code_t code, coap_list_t *optlist,
55         const char* payload);
56
57 void CAParseURI(const char* uriInfo, coap_list_t **options);
58
59 void CAParseHeadOption(const uint32_t code, const CAInfo_t info, coap_list_t **optlist);
60
61 coap_list_t* CACreateNewOptionNode(const uint16_t key, const uint32_t length, const uint8_t *data);
62
63 int32_t CAOrderOpts(void *a, void *b);
64
65 void CAGetRequestPDUInfo(const coap_pdu_t *pdu, uint32_t* outCode, CAInfo_t* outInfo);
66
67 coap_pdu_t* CAParsePDU(const char* data, uint32_t* outCode);
68
69 /**
70  * function for token
71  */
72 CAResult_t CAGenerateTokenInternal(CAToken_t* token);
73
74 void CADestroyTokenInternal(CAToken_t token);
75
76 #ifdef __cplusplus
77 } /* extern "C" */
78 #endif
79
80 #endif //#ifndef __CA_PROTOCOL_MESSAGE_H_