XrdSecInterface.hh

Go to the documentation of this file.
00001 #ifndef __SEC_INTERFACE_H__
00002 #define __SEC_INTERFACE_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                    X r d S e c I n t e r f a c e . h h                     */
00006 /*                                                                            */
00007 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00009 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00010 /*                                                                            */
00011 /* This file is part of the XRootD software suite.                            */
00012 /*                                                                            */
00013 /* XRootD is free software: you can redistribute it and/or modify it under    */
00014 /* the terms of the GNU Lesser General Public License as published by the     */
00015 /* Free Software Foundation, either version 3 of the License, or (at your     */
00016 /* option) any later version.                                                 */
00017 /*                                                                            */
00018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00020 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00021 /* License for more details.                                                  */
00022 /*                                                                            */
00023 /* You should have received a copy of the GNU Lesser General Public License   */
00024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00025 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00026 /*                                                                            */
00027 /* The copyright holder's institutional names and contributor's names may not */
00028 /* be used to endorse or promote products derived from this software without  */
00029 /* specific prior written permission of the institution or contributor.       */
00030 /******************************************************************************/
00031 
00032 #include <errno.h>
00033 #ifndef WIN32
00034 #include <sys/param.h>
00035 #endif
00036 #include <stdlib.h>
00037 #include <stdio.h>
00038 #include <string.h>
00039 
00040 #include "XrdSec/XrdSecEntity.hh"
00041 
00042 /******************************************************************************/
00043 /*  X r d S e c C r e d e n t i a l s   &   X r d S e c P a r a m e t e r s   */
00044 /******************************************************************************/
00045   
00046 //------------------------------------------------------------------------------
00048 //------------------------------------------------------------------------------
00049 
00050 struct XrdSecBuffer
00051 {
00052        int   size;    
00053        char *buffer;  
00054 
00055        XrdSecBuffer(char *bp=0, int sz=0) : size(sz), buffer(bp), membuf(bp) {}
00056       ~XrdSecBuffer() {if (membuf) free(membuf);}
00057 
00058 private:
00059         char *membuf; // Stable copy of the buffer address
00060 };
00061 
00062 //------------------------------------------------------------------------------
00067 //------------------------------------------------------------------------------
00068 
00069 typedef XrdSecBuffer XrdSecCredentials;
00070 
00071 //------------------------------------------------------------------------------
00077 //------------------------------------------------------------------------------
00078 
00079 typedef XrdSecBuffer XrdSecParameters;
00080   
00081 /******************************************************************************/
00082 /*                        X r d S e c P r o t o c o l                         */
00083 /******************************************************************************/
00128 class XrdOucErrInfo;
00129 
00130 class XrdSecProtocol
00131 {
00132 public:
00133 
00134 //------------------------------------------------------------------------------
00137 //------------------------------------------------------------------------------
00138 
00139 XrdSecEntity               Entity;
00140 
00141 //------------------------------------------------------------------------------
00154 //------------------------------------------------------------------------------
00155 
00156 virtual int                Authenticate  (XrdSecCredentials  *cred,
00157                                           XrdSecParameters  **parms,
00158                                           XrdOucErrInfo      *einfo=0)=0;
00159 
00160 //------------------------------------------------------------------------------
00173 //------------------------------------------------------------------------------
00174 
00175 virtual XrdSecCredentials *getCredentials(XrdSecParameters   *parm=0,
00176                                           XrdOucErrInfo      *einfo=0)=0;
00177 
00178 //------------------------------------------------------------------------------
00191 //------------------------------------------------------------------------------
00192 
00193 virtual int     Encrypt(const char    *inbuff,  // Data to be encrypted
00194                               int      inlen,   // Length of data in inbuff
00195                         XrdSecBuffer **outbuff  // Returns encrypted data
00196                              ) 
00197 {
00198   (void) inbuff; (void) inlen; (void) outbuff;
00199   return -ENOTSUP;
00200 }
00201 
00202 //------------------------------------------------------------------------------
00212 //------------------------------------------------------------------------------
00213 
00214 virtual int     Decrypt(const char  *inbuff,   // Data to be decrypted
00215                               int    inlen,    // Length of data in inbuff
00216                       XrdSecBuffer **outbuff   // Buffer for decrypted data
00217                               ) 
00218 {
00219   (void) inbuff; (void) inlen; (void) outbuff;
00220   return -ENOTSUP;
00221 }
00222 
00223 //------------------------------------------------------------------------------
00233 //------------------------------------------------------------------------------
00234 
00235 virtual int     Sign(const char  *inbuff,   // Data to be signed
00236                            int    inlen,    // Length of data in inbuff
00237                    XrdSecBuffer **outbuff   // Buffer for the signature
00238                            ) 
00239 {
00240   (void) inbuff; (void) inlen; (void) outbuff;
00241   return -ENOTSUP;
00242 }
00243 
00244 //------------------------------------------------------------------------------
00255 //------------------------------------------------------------------------------
00256 
00257 virtual int     Verify(const char  *inbuff,   // Data to be decrypted
00258                              int    inlen,    // Length of data in inbuff
00259                        const char  *sigbuff,  // Buffer for signature
00260                              int    siglen)   // Length if signature
00261 {
00262   (void) inbuff; (void) inlen; (void) sigbuff; (void) siglen;
00263   return -ENOTSUP;
00264 }
00265 
00266 //------------------------------------------------------------------------------
00277 //------------------------------------------------------------------------------
00278 
00279 virtual int     getKey(char *buff = 0, int size = 0) 
00280 {
00281   (void) buff; (void) size;
00282   return -ENOTSUP;
00283 }
00284 
00285 //------------------------------------------------------------------------------
00293 //------------------------------------------------------------------------------
00294 
00295 virtual int     setKey(char *buff, int size) 
00296 {
00297   (void) buff; (void) size;
00298   return -ENOTSUP;
00299 }
00300 
00301 //------------------------------------------------------------------------------
00303 //------------------------------------------------------------------------------
00304 
00305 virtual void    Delete()=0; // Normally does "delete this"
00306 
00307 //------------------------------------------------------------------------------
00309 //------------------------------------------------------------------------------
00310 
00311               XrdSecProtocol(const char *pName) : Entity(pName) {}
00312 protected:
00313 
00314 //------------------------------------------------------------------------------
00316 //------------------------------------------------------------------------------
00317 
00318 virtual      ~XrdSecProtocol() {}
00319 };
00320  
00321 /******************************************************************************/
00322 /*           P r o t o c o l   N a m i n g   C o n v e n t i o n s            */
00323 /******************************************************************************/
00324 
00338 //------------------------------------------------------------------------------
00361 //------------------------------------------------------------------------------
00362 
00368 //------------------------------------------------------------------------------
00397 //------------------------------------------------------------------------------
00398 
00413 /******************************************************************************/
00414 /*            P r o t o c o l   O b j e c t   M a n a g e m e n t             */
00415 /******************************************************************************/
00416 
00420   
00421 /******************************************************************************/
00422 /*                     X r d S e c G e t P r o t o c o l                      */
00423 /*                                                                            */
00424 /*                  C l i e n t   S i d e   U S e   O n l y                   */
00425 /******************************************************************************/
00426   
00427 //------------------------------------------------------------------------------
00459 //------------------------------------------------------------------------------
00460 
00461 //------------------------------------------------------------------------------
00463 //------------------------------------------------------------------------------
00464 
00465 typedef XrdSecProtocol *(*XrdSecGetProt_t)(const char *,
00466                                            XrdNetAddrInfo &,
00467                                            XrdSecParameters &,
00468                                            XrdOucErrInfo *);
00469 
00483 /******************************************************************************/
00484 /*                   X r d S e c G e t P r o t e c t i o n                    */
00485 /*                                                                            */
00486 /*                  C l i e n t   S i d e   U s e   O n l y                   */
00487 /******************************************************************************/
00488   
00516 /******************************************************************************/
00517 /*                         X r d S e c S e r v i c e                          */
00518 /*                                                                            */
00519 /*                  S e r v e r   S i d e   U s e   O n l y                   */
00520 /******************************************************************************/
00521   
00535 class XrdSecService
00536 {
00537 public:
00538 
00539 //------------------------------------------------------------------------------
00551 //------------------------------------------------------------------------------
00552 
00553 virtual const char     *getParms(int &size, XrdNetAddrInfo *endPoint=0) = 0;
00554 
00555 //------------------------------------------------------------------------------
00577 //------------------------------------------------------------------------------
00578 
00579 virtual XrdSecProtocol *getProtocol(const char              *host,    // In
00580                                           XrdNetAddrInfo    &endPoint,// In
00581                                     const XrdSecCredentials *cred,    // In
00582                                           XrdOucErrInfo     *einfo)=0;// Out
00583 
00584 //------------------------------------------------------------------------------
00586 //------------------------------------------------------------------------------
00587 
00588                         XrdSecService() {}
00589 
00590 //------------------------------------------------------------------------------
00592 //------------------------------------------------------------------------------
00593 
00594 virtual                ~XrdSecService() {}
00595 };
00596   
00597 /******************************************************************************/
00598 /*                      X r d g e t S e c S e r v i c e                       */
00599 /******************************************************************************/
00600   
00601 //------------------------------------------------------------------------------
00621 //------------------------------------------------------------------------------
00622 
00623 
00624 //------------------------------------------------------------------------------
00626 //------------------------------------------------------------------------------
00627 
00628 class XrdSysLogger;
00629 typedef XrdSecService  *(*XrdSecGetServ_t)(XrdSysLogger *, const char *);
00630 
00638 #endif

Generated on 13 Mar 2017 for xrootd by  doxygen 1.4.7