1 /* 2 * eap_chbind.c 3 * 4 * Version: $Id: 346b71261dbaef0919b35132df305eecbf944c8c $ 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 * 20 * Copyright 2014 Network RADIUS SARL 21 * Copyright 2014 The FreeRADIUS server project 22 */ 23 24 #ifndef _EAP_CHBIND_H 25 #define _EAP_CHBIND_H 26 27 RCSIDH(eap_chbind_h, "$Id: 346b71261dbaef0919b35132df305eecbf944c8c $") 28 29 #include <stdio.h> 30 #include <stdlib.h> 31 #include <sys/types.h> 32 #include <ctype.h> 33 34 #include <freeradius-devel/radiusd.h> 35 36 #include "eap.h" 37 38 /* Structure to represent eap channel binding packet format */ 39 typedef struct chbind_packet_t { 40 uint8_t code; 41 uint8_t data[1]; 42 } chbind_packet_t; 43 44 /* Structure to hold channel bindings req/resp information */ 45 typedef struct CHBIND_REQ { 46 VALUE_PAIR *username; /* the username */ 47 chbind_packet_t *request; /* channel binding request buffer */ 48 chbind_packet_t *response; /* channel binding response buffer */ 49 } CHBIND_REQ; 50 51 /* Protocol constants */ 52 #define CHBIND_NSID_RADIUS 1 53 54 #define CHBIND_CODE_REQUEST 1 55 #define CHBIND_CODE_SUCCESS 2 56 #define CHBIND_CODE_FAILURE 3 57 58 /* Channel binding function prototypes */ 59 PW_CODE chbind_process(REQUEST *request, CHBIND_REQ *chbind_req); 60 61 VALUE_PAIR *eap_chbind_packet2vp(RADIUS_PACKET *packet, chbind_packet_t *chbind); 62 chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, VALUE_PAIR *vps); 63 64 #endif /*_EAP_CHBIND_H*/ 65