# GSSAPIHandler.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002, 2003  ONERA
    00004 //
    00005 // This file is part of CERTI-libCERTI
    00006 //
    00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: GSSAPIHandler.hh,v 3.4 2003/06/27 17:26:28 breholee Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef _CERTI_GSSAPI_HANDLER_HH
    00026 #define _CERTI_GSSAPI_HANDLER_HH
    00027 #ifdef WITH_GSSAPI
    00028
    00029 #include "gssapi.h"
    00030
    00031 namespace certi {
    00032
    00033 class GSSAPIHandler
    00034 {
    00035 public:
    00036
    00037     typedef enum GSSRole {GSS_Client, GSS_Server};
    00038
    00039     // --------------------------------
    00040     // -- Constructor and Destructor --
    00041     // --------------------------------
    00042     GSSAPIHandler();
    00043     ~GSSAPIHandler();
    00044
    00045     // -----------
    00046     // -- Names --
    00047     // -----------
    00048     void setLocalName(char *PrincipalName);
    00049     void setRemoteName(char *PrincipalName);
    00050     char *getRemoteName();
    00051
    00052     // ------------------
    00053     // -- Init Session --
    00054     // ------------------
    00055     void initSecContext(SocketTCP *Socket);
    00056     void acceptSecContext(SocketTCP *Socket);
    00057
    00058     // ------------------------------
    00059     // -- Message Exchange Methods --
    00060     // ------------------------------
    00061     void getMessage(SocketTCP *Socket, gss_buffer_t IncomingBuffer);
    00062     void releaseBuffer(gss_buffer_t IncomingBuffer);
    00063     void sendMessage(SocketTCP *Socket, gss_buffer_t OutcomingBuffer);
    00064
    00065 private:
    00066
    00067     // ---------------------
    00068     // -- Private Methods --
    00069     // ---------------------
    00070     void acquireCred(int initOrAccept);
    00071     void detectError(char *contextString = NULL);
    00072
    00073     void getToken(SocketTCP *socket, gss_buffer_desc &buffer);
    00074     void sendToken(SocketTCP *socket, gss_buffer_desc buffer);
    00075
    00076     // ------------------------
    00077     // -- Private Attributes --
    00078     // ------------------------
    00079
    00080     Boolean InitSecContext_Started ;
    00081
    00082     // Principal Names
    00083     gss_name_t LocalName ; // Internal form
    00084     gss_name_t RemoteName ; // Internal form
    00085
    00086     // Return Codes
    00087     OM_uint32 Code ;
    00088     OM_uint32 Minor ;
    00089
    00090     // Local credential
    00091     gss_cred_id_t Credential ;
    00092
    00093     // Local context(Only initiator(client) may delete the context)
    00094     gss_ctx_id_t Context ;
    00095
    00096     // Actual Mechanism
    00097     gss_OID MechType ;
    00098
    00099     // Role
    00100     Boolean IsClient ;
    00101 };
    00102 }
    00103
    00104 #endif // WITH_GSSAPI
    00105 #endif // _CERTI_GSSAPI_HANDLER_HH
    00106
    00107 // $Id: GSSAPIHandler.hh,v 3.4 2003/06/27 17:26:28 breholee Exp $