Blame view

src/INCLUDE/DD_Access.h 3.86 KB
4243d674   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* ======================================================
 *
 *           DD_Access.h
 *           V.2.0
 *      Last revision: Oct 7, 2002
 *     List  of revisions: 1997 - version 1.0
 *     Oct 7, 2002 - version 2.0 (update a little )
 */

#define MAXHOSTLENGTH   16  /*  IP-address:  "255.255.255.255\0"  */
#define USRLENGTH       21      /*  Length of UserName:  + \0  */
#define TICKETLENGTH    9    /*  Length of passwd: 8 + \0  */
#define HOSTNAMELENGTH  120 /* Length of the user host name */
#define USERCASHLEN     100  /*  Size of user_ticket.nc file must be 300  */
#define NONAME          "no_name\0" /* Name of user in case of non-WEB connection */
#define ACCINSTR        "iball:acc:all"    /* Instrument which watch the  access */
#define TICKET_PATH     "/ACC/user_ticket.nc"
#define USERREFNAME     "/ACC/user_info.nc"
#define LOGFILE         "/ACC/login.log"

/*------------ Errors of   ACCESS ---------------------*/
#define NOPERMISSION     -100
#define NOHOST           -101
#define NOUSERSFILE      -102

/*--------------- Extern global variables -------------------*/
extern  char UserName[USRLENGTH]; /* defined in DD_client.c */
extern  char UserHost[MAXHOSTLENGTH]; /* defined in DD_client.c */
extern  int  UserID;                  /* defined in  DD_client.c   */

/*--------------- Extern Functions ---------------------------*/
extern int  FillStruct  (int argc, void **argv);
/* This function used to set up the host address from IDL (when WWW access used)
 * Arguments allocation is as follows:
 *  UserName - 0
 *  UserHost  - 1
 *  Location: DD_idl.c -> DD_idl.so
*/

extern int GetTicket(int UID, char *HostName, int DD_user_id);
/* Description: This function find the user data in user_cash.nc
 *              If O'k rewrite the line with new time.
 *              In case of a new user, remove the first line with 
 *              older time data then a current time + 4.5 hours.
                *
                Takes 3 arguments: UserId (id in the romote host)
                                   Remote host address(string,like "193.232.6.60\0")
                                   DD_user_id(can see in user_info.nc)
                                  
                Returns 0 if O'k or NOPERMISSIONS, or ERROR
                
                If DD_log_name equal NULL searching for UserId, IP-address
                If DD_log_name nonequal NULL searching for IP-address,DD_log_name*
                *
 */
extern int CheckTicket(char *NameUsr, char *Ticket);
/* Description: This function check if user exosts
 *              in user_info.nc file. Returns DD_id if O'k. 
 *              It returns NOPERMISSION or other errors
 */
      
extern int ShowTicket(int userid, char *hostname, char *DD_name);
/*
 * Show if user has authorisation to work
 */

extern int LoginRequest(char *UserPasswd, char *UserLogin, char *HostName);
/* Description: Library function for client-server using.  
 *              Send ID, Password,UserLogin, and host to server.
 *              Compares the information with your {id,hostname and other}.
 *              Returns 0 if O'k, or a negative value in case 
 *              of "NOPERMISSION" or error.
 *
 */
extern int SetUser(int UserID, char *HostName, char *LogName);
/* Description: Library function for client-server using.
 *              Send UserID, HostName to server.
 *              Compares the information with your {id,hostname}.
 *              Returns 1 if O'k, or a NOPERMISSION, or error number
 */

extern int CheckID(char *NameUsr);
/* Description: This function check the user name in user_info.nc file. 
 *              Returns DD_id if exists. 
 *              It returns NOPERMISSION or other errors
 */

extern void Put2Log(int UID, char *Host, char *LogName, int error);
/* Description: This function logs a user's ID, IP-address of a local host,
 *              login name and permission information into log file. 
 *              
 */