ROOT  6.06/09
Reference Guide
DaemonUtils.h
Go to the documentation of this file.
1 // @(#)root/auth:$Id$
2 // Author: Gerri Ganis 19/1/2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_DaemonUtils
13 #define ROOT_DaemonUtils
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // DaemonUtils //
19 // //
20 // This file defines wrappers to client utils calls used by server //
21 // authentication daemons. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include <string>
26 
27 #ifndef ROOT_TSocket
28 #include "TSocket.h"
29 #endif
30 #ifndef ROOT_TSeqCollection
31 #include "TSeqCollection.h"
32 #endif
33 #ifndef ROOT_NetErrors
34 #include "NetErrors.h"
35 #endif
36 #ifndef ROOT_rpddefs
37 #include "rpddefs.h"
38 #endif
39 
40 
41 extern Int_t SrvAuthImpl(TSocket *socket, const char *, const char *,
42  std::string &user, Int_t &meth,
43  Int_t &type, std::string &ctoken, TSeqCollection *);
45 
46 typedef void (*ErrorHandler_t)(int level, const char *msg, int size);
47 
48 
49 namespace ROOT {
50 
51 // Error handlers prototypes ...
52 extern ErrorHandler_t gErrSys;
54 extern ErrorHandler_t gErr;
55 
56 int GetErrno();
57 void ResetErrno();
58 void ErrorInit(const char *ident);
59 void ErrorInfo(const char *fmt, ...);
60 void Perror(char *buf, int size);
61 void Error(ErrorHandler_t ErrHand,int code,const char *fmt, ...);
62 
63 void RpdAuthCleanup(const char *sstr, int opt);
64 int RpdCleanupAuthTab(const char *crypttoken);
65 int RpdGenRSAKeys(int);
68 void RpdSetMethInitFlag(int methinit);
69 int RpdInitSession(int, std::string &, int &, int &, int &, std::string &);
70 void RpdInit(EService serv, int pid, int sproto,
71  unsigned int opts, int rumsk, int sshp,
72  const char *tmpd, const char *asrpp, int login = 0);
73 
74 void SrvSetSocket(TSocket *socket);
75 
76 void NetClose();
77 int NetParOpen(int port, int size);
78 int NetRecv(char *msg, int max);
79 int NetRecv(char *msg, int len, EMessageTypes &kind);
80 int NetRecv(void *&buf, int &len, EMessageTypes &kind);
81 int NetRecvRaw(void *buf, int len);
82 int NetRecvRaw(int sock, void *buf, int len);
83 int NetSend(int code, EMessageTypes kind);
84 int NetSend(const char *msg, EMessageTypes kind);
85 int NetSend(const void *buf, int len, EMessageTypes kind);
86 int NetSendAck();
87 int NetSendError(ERootdErrors err);
88 int NetSendRaw(const void *buf, int len);
89 void NetGetRemoteHost(std::string &openhost);
90 int NetGetSockFd();
91 
92 }
93 
94 #endif
int NetSendError(ERootdErrors err)
Send error code.
int GetErrno()
return errno
void RpdSetMethInitFlag(int methinit)
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
void Fatal(const char *location, const char *msgfmt,...)
int NetGetSockFd()
return open socket descriptor
ErrorHandler_t gErr
int NetRecvRaw(void *buf, int len)
Receive a buffer of maximum len bytes.
void ErrorInfo(const char *va_(fmt),...)
Formats a string in a circular formatting buffer and prints the string.
int Int_t
Definition: RtypesCore.h:41
int NetRecv(char *msg, int max)
Receive a string of maximum length max.
void RpdInit(EService serv, int pid, int sproto, unsigned int opts, int rumsk, int sshp, const char *tmpd, const char *asrpp, int login=0)
Int_t SrvClupImpl(TSeqCollection *)
Wrapper to cleanup code.
int NetSendRaw(const void *buf, int len)
Send buffer of len bytes.
ErrorHandler_t gErrSys
Sequenceable collection abstract base class.
int RpdCleanupAuthTab(const char *crypttoken)
void SrvSetSocket(TSocket *Socket)
Fill socket parameters.
void RpdSetErrorHandler(ErrorHandler_t Err, ErrorHandler_t Sys, ErrorHandler_t Fatal)
void RpdAuthCleanup(const char *sstr, int opt)
void(* ErrorHandler_t)(int level, const char *msg, int size)
Definition: DaemonUtils.h:46
ErrorHandler_t gErrFatal
void ResetErrno()
reset errno
Int_t SrvAuthImpl(TSocket *socket, const char *, const char *, std::string &user, Int_t &meth, Int_t &type, std::string &ctoken, TSeqCollection *)
Server authentication code.
int NetSend(int code, EMessageTypes kind)
Send integer. Message will be of type "kind".
EMessageTypes
Definition: MessageTypes.h:27
int NetParOpen(int port, int size)
Empty call, for consistency.
void NetGetRemoteHost(std::string &openhost)
Return name of connected host.
int RpdGenRSAKeys(int)
int type
Definition: TGX11.cxx:120
int NetSendAck()
Send acknowledge code.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
void NetClose()
Empty call, for consistency.
typedef void((*Func_t)())
void Err(int level, const char *msg, int size)
void ErrorInit(const char *ident)
void Perror(char *buf, int size)
Return in buf the message belonging to errno.
int RpdInitSession(int, std::string &, int &, int &, int &, std::string &)
ERootdErrors
Definition: NetErrors.h:28
void Error(ErrorHandler_t func, int code, const char *va_(fmt),...)
Write error message and call a handler, if required.