1// 2// tlsnke.h 3// tlsnke 4// 5// Created by Fabrice Gautier on 1/12/12. 6// Copyright (c) 2012 Apple, Inc. All rights reserved. 7// 8 9#ifndef __TLSNKE_H__ 10#define __TLSNKE_H__ 11 12/* Those should be defined in kernel headers eg <sys/scoket.h> */ 13 14 15#define TLS_HANDLE_IP4 0xBABABABA /* Temp hack to identify this filter */ 16#define TLS_HANDLE_IP6 0xABABABAB /* Temp hack to identify this filter */ 17 18 19/* 20SO_TLS_HANDLE: 21Get the DTLS handle used to enable utun to dtls bypass. (getsockopt only) 22option_value type: int 23*/ 24#define SO_TLS_HANDLE 0x20000 25 26/* 27SO_TLS_INIT_CIPHER: 28Initialize the new cipher key material. (setsockopt only) 29option_value type: 30struct { 31 uint16_t cipherspec; 32 bool server; 33 int keylen; 34 char key[keylen]; 35} 36*/ 37#define SO_TLS_INIT_CIPHER 0x20001 38 39/* 40SO_TLS_PROTOCOL_VERSION: 41Set the protocol version. (setsockopt only) 42option_value type: int 43*/ 44#define SO_TLS_PROTOCOL_VERSION 0x20002 45 46/* 47SO_TLS_ADVANCE_READ_CIPHER: 48Update the read cipher to use the new key. (setsockopt only) 49No option value. 50*/ 51#define SO_TLS_ADVANCE_READ_CIPHER 0x20003 52 53/* 54SO_TLS_ADVANCE_WRITE_CIPHER: 55Update the write cipher to use the new key. (setsockopt only) 56No option value. 57*/ 58#define SO_TLS_ADVANCE_WRITE_CIPHER 0x20004 59 60/* 61SO_TLS_ROLLBACK_WRITE_CIPHER: 62Rollback the write cipher to the previous key. (setsockopt only) 63No option value. 64*/ 65#define SO_TLS_ROLLBACK_WRITE_CIPHER 0x20005 66 67/* 68 SO_TLS_SERVICE_WRITE_QUEUE: 69 Service the record write queue 70 No option value. 71 */ 72#define SO_TLS_SERVICE_WRITE_QUEUE 0x20006 73 74 75/* 76SCM_TLS_HEADER: 77 Type of anciallary data for DTLS record header 78*/ 79 80#define SCM_TLS_HEADER 0x12345 81 82typedef struct tls_record_hdr{ 83 uint8_t content_type; 84 uint16_t protocol_version; 85} *tls_record_hdr_t; 86 87 88#endif /* __TLSNKE_H__ */ 89