Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

connector.h

Go to the documentation of this file.
00001 /*
00002  *  connector.h - public library interface
00003  *  
00004  *  EAP-IKEv2
00005  *
00006  *  This library implements ideas of draft-tschofenig-eap-ikev2-10.txt
00007  *  Internet-Draft. Version of the document that this library corresponds
00008  *  to you can find at
00009  *  http://tools.ietf.org/wg/eap/draft-tschofenig-eap-ikev2-10.txt.
00010  *
00011  *  This file is part of libeap-ikev2.
00012  *
00013  *  libeap-ikev2 is free software; you can redistribute it and/or modify
00014  *  it under the terms of the GNU General Public License as published by
00015  *  the Free Software Foundation; either version 2 of the License, or
00016  *  (at your option) any later version.
00017  *
00018  *  libeap-ikev2 is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU General Public License for more details.
00022  *
00023  *  You should have received a copy of the GNU General Public License
00024  *  along with libeap-ikev2; if not, write to the Free Software
00025  *
00026  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  *  Copyright (C) 2005-2006 Krzysztof Rzecki <krzysztof.rzecki@ccns.pl>      
00029  *  Copyright (C) 2005-2006 Rafal Mijal <rafal.mijal@ccns.pl>                
00030  *  Copyright (C) 2005-2006 Piotr Marnik <piotr.marnik@ccns.pl>              
00031  *  Copyright (C) 2005-2006 Pawel Matejski <pawel.matejski@ccns.pl>          
00032  *  Copyright (C) 2003      Udo Schilcher <udo.schilcher@edu.uni-klu.ac.at>
00033  *  Copyright (C) 2003      Thomas Hambrusch <thambrus@edu.uni-klu.ac.at>          
00034  *
00035  */
00036 
00037 #ifndef CONNECTOR_H
00038 #define CONNECTOR_H
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 #include "common.h"
00045 
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048 
00049 #include <openssl/rand.h>
00050 
00051 #include "session.h"
00052 #include "payload.h"
00053 #include "message.h"
00054 #include "IKEv2.h"
00055 #include "payload.h"
00056 #include "conf_utils.h"
00057 #include "enums.h"
00058 #include "auth.h"
00059 
00060 
00061 
00062 // eap message codes (to remove!!!!!!!!!!!!!!!!!!!!!!!!!!!)
00063 
00064 #define EAP_CODE_REQUEST      1
00065 #define EAP_CODE_RESPONSE     2
00066 #define EAP_CODE_SUCCESS      3
00067 #define EAP_CODE_FAILURE      4
00068 
00084 #define EAP_HDF_LENGTHINCLUDED     (1<<0)
00085 #define EAP_HDF_MOREFRAGMENTS      (1<<1)
00086 #define EAP_HDF_INTEGRITYINCLUDED  (1<<2)
00087 
00091 struct EAPHeader 
00092 {
00093         uint8_t Code;
00094         uint8_t Id;
00095         uint16_t Length;         
00096         uint8_t Type;
00097         uint8_t Flags;
00098 }__attribute__((packed));
00099 
00105 struct IKEv2Data 
00106 {
00107     struct ikev2_ctx *i2;               
00108     struct IKEv2Session *session;       
00109 };
00110 
00111 #define EAPIKEv2_TYPE 47
00112 
00113 int CertInit( struct ikev2_ctx *i2 );
00114 int IKEv2Init( struct ikev2_ctx *i2 );
00115 
00116 void IKEv2Shutdown(void);
00117 int GenEapKeys(struct IKEv2Session *s, int len);
00118 
00119 uint32_t CreateIKEv2Message(const ikev2_ctx *i2, uint8_t *ikemsg, uint32_t imlen, bool response, uint8_t msgid,
00120                              struct IKEv2Session *session, uint8_t **out );
00121 
00122 int ExtractData(const uint8_t *in, uint8_t **data, uint32_t *dlen, uint32_t ilen );
00123 
00124 int ParseIKEv2Message(const uint8_t *in, uint8_t **ikemsg, uint32_t *imlen, struct IKEv2Session *session );
00125 
00126 uint32_t CreateResultMessage( bool succ, struct IKEv2Session *session, uint8_t **out );
00127 
00128 uint16_t CreateFragmentAck(const uint8_t *in, uint8_t **out, struct IKEv2Session *session );
00129 
00130 int ParseFragmentAck(const uint8_t *in, struct IKEv2Session *session );
00131 
00132 struct IKEv2Data * IKEv2Data_new(struct ikev2_ctx *i2, struct IKEv2Session *s);
00133 
00134 #ifdef __cplusplus
00135 }
00136 #endif
00137 
00138 #endif //CONNECTOR_H

Project hosted by: SourceForge.net Logo