1/*
2 * Copyright (c) 2002-2013 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _EAP8021X_EAPTLS_H
25#define _EAP8021X_EAPTLS_H
26
27/*
28 * EAPTLS.h
29 * - definitions for EAP-TLS
30 */
31
32/*
33 * Modification History
34 *
35 * August 26, 2002	Dieter Siegmund (dieter@apple)
36 * - created
37 */
38
39#include <stdint.h>
40
41typedef struct {
42    uint8_t		code;
43    uint8_t		identifier;
44    uint8_t		length[2];	/* of entire request/response */
45    uint8_t		type;
46    uint8_t		flags;
47    uint8_t		tls_data[0];
48} EAPTLSPacket, *EAPTLSPacketRef, EAPTLSFragment, *EAPTLSFragmentRef;
49
50typedef struct {
51    uint8_t		code;
52    uint8_t		identifier;
53    uint8_t		length[2];	/* of entire request/response */
54    uint8_t		type;
55    uint8_t		flags;
56    uint8_t		tls_message_length[4]; /* if flags.L == 1 */
57    uint8_t		tls_data[0];
58} EAPTLSLengthIncludedPacket, *EAPTLSLengthIncludedPacketRef;
59
60typedef enum {
61    kEAPTLSPacketFlagsLengthIncluded	= 0x80,
62    kEAPTLSPacketFlagsMoreFragments 	= 0x40,
63    kEAPTLSPacketFlagsStart 		= 0x20,
64} EAPTLSPacketFlags;
65
66uint32_t
67EAPTLSLengthIncludedPacketGetMessageLength(EAPTLSLengthIncludedPacketRef pkt);
68
69void
70EAPTLSLengthIncludedPacketSetMessageLength(EAPTLSLengthIncludedPacketRef pkt,
71					   uint32_t length);
72#endif /* _EAP8021X_EAPTLS_H */
73