• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef REC_UNPROCESSED_MSG_H
17 #define REC_UNPROCESSED_MSG_H
18 
19 #include <stdint.h>
20 #include "bsl_module_list.h"
21 #include "rec_header.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #ifdef HITLS_TLS_PROTO_DTLS12
28 
29 typedef struct {
30     RecHdr hdr;                     /* record header */
31     uint8_t *recordBody;            /* record body */
32 } UnprocessedHsMsg;                 /* Unprocessed handshake messages */
33 
34 /*  rfc6083 4.7 Handshake
35     User messages that arrive between ChangeCipherSpec and Finished
36     messages and use the new epoch have probably passed the Finished
37     message and MUST be buffered by DTLS until the Finished message is
38     read.
39 */
40 typedef struct {
41     ListHead head;
42     uint32_t count;                 /* Number of cached record messages */
43     RecHdr hdr;                     /* record header */
44     uint8_t *recordBody;            /* record body */
45 } UnprocessedAppMsg;                /* Unprocessed App messages: App messages that are out of order with finished */
46 
47 void CacheNextEpochHsMsg(UnprocessedHsMsg *unprocessedHsMsg, const RecHdr *hdr, const uint8_t *recordBody);
48 
49 UnprocessedAppMsg *UnprocessedAppMsgNew(void);
50 
51 void UnprocessedAppMsgFree(UnprocessedAppMsg *msg);
52 
53 void UnprocessedAppMsgListInit(UnprocessedAppMsg *appMsgList);
54 
55 void UnprocessedAppMsgListDeinit(UnprocessedAppMsg *appMsgList);
56 
57 int32_t UnprocessedAppMsgListAppend(UnprocessedAppMsg *appMsgList, const RecHdr *hdr, const uint8_t *recordBody);
58 
59 UnprocessedAppMsg *UnprocessedAppMsgGet(UnprocessedAppMsg *appMsgList, uint16_t curEpoch);
60 
61 #endif // HITLS_TLS_PROTO_DTLS12
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif