blob: 1c2cc379f2f3ff9f3f2d4bc0097445edb39b58cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*
* Copyright (C) 2014 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup encrypted_fragment_payload encrypted_fragment_payload
* @{ @ingroup payloads
*/
#ifndef ENCRYPTED_FRAGMENT_PAYLOAD_H_
#define ENCRYPTED_FRAGMENT_PAYLOAD_H_
typedef struct encrypted_fragment_payload_t encrypted_fragment_payload_t;
#include <encoding/payloads/encrypted_payload.h>
/**
* The Encrypted Fragment Payload as described in RFC 7383
*
* The implementation is located in encrypted_payload.c as it is very similar.
*/
struct encrypted_fragment_payload_t {
/**
* Implements payload_t interface.
*/
encrypted_payload_t encrypted;
/**
* Get the fragment number.
*
* @return fragment number
*/
u_int16_t (*get_fragment_number)(encrypted_fragment_payload_t *this);
/**
* Get the total number of fragments.
*
* @return total number of fragments
*/
u_int16_t (*get_total_fragments)(encrypted_fragment_payload_t *this);
/**
* Get the (decrypted) content of this payload.
*
* @return internal payload data
*/
chunk_t (*get_content)(encrypted_fragment_payload_t *this);
/**
* Destroys an encrypted_fragment_payload_t object.
*/
void (*destroy)(encrypted_fragment_payload_t *this);
};
/**
* Creates an empty encrypted_fragment_payload_t object.
*
* @return encrypted_fragment_payload_t object
*/
encrypted_fragment_payload_t *encrypted_fragment_payload_create();
/**
* Creates an encrypted fragment payload from the given data.
*
* @param num fragment number (first one should be 1)
* @param total total number of fragments
* @param data fragment data (gets cloned)
* @return encrypted_fragment_payload_t object
*/
encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
u_int16_t num, u_int16_t total, chunk_t data);
#endif /** ENCRYPTED_FRAGMENT_PAYLOAD_H_ @}*/
|