File: server_def.h

package info (click to toggle)
fsp 2.81.b24-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,904 kB
  • ctags: 1,423
  • sloc: ansic: 9,215; sh: 3,639; makefile: 212; lex: 130; csh: 77; python: 22
file content (121 lines) | stat: -rw-r--r-- 4,933 bytes parent folder | download | duplicates (3)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    /*********************************************************************\
    *  Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu)   *
    *                                                                     *
    *  You may copy or modify this file in any manner you wish, provided  *
    *  that this notice is always included, and that you hold the author  *
    *  harmless for any loss or damage resulting from the installation or *
    *  use of this software.                                              *
    \*********************************************************************/

#ifndef _FSP_SERVER_DEF_H_
#define _FSP_SERVER_DEF_H_ 1

#include "common_def.h"
#include "server_conf.h"


/****************************************************************************
*  HTAB is structure for storing client information for one client machine.
*  They makes it easy to reuse regular unix tool's source for new purposes.
****************************************************************************/

typedef struct HTAB HTAB;

struct HTAB {	unsigned long	inet_num;	/* inet number of client     */
		char	       *hostname;	/* hostname of client        */
		time_t          last_acc;	/* last sucessful access time*/
		unsigned short	next_key;	/* next key client should use*/
		unsigned short	last_key;	/* previous key client used  */
		unsigned short   acc_cnt;	/* number of successful acc  */
		unsigned short   active; };	/* session continuing.	     */

/****************************************************************************
*  IPrange is the structure for storing information about disabled, ignored
*  or normal hosts.
****************************************************************************/
typedef struct {
    unsigned char lo[4];
    unsigned char hi[4];
    char *text;
} IPrange;

/*****************************************************************************
* The PPATH structure is filled in by the function check_path when given a
* path string.  See server_file.c for more info.
*****************************************************************************/

typedef struct {
    const char    *fullp; /* ptr to string containing full pathname  */
    const char    *f_ptr; /* ptr to begining of last path component  */
    unsigned int   f_len; /* length of last component in path        */
    const char    *d_ptr; /* ptr to beginning of directory component */
    unsigned int   d_len; /* length of directory part of path.       */
    const char   *passwd; /* ptr to password                  */
    char     inetstr[16]; /* inet-address of remote-FSP        */
    char      portstr[8];  /* port of remote-FSP                */
} PPATH;

/* open file handles cache */
typedef struct { FILE *fp;
                 unsigned long inet_num;
                 unsigned long port_num;
               } FPCACHE;

/* DIRLISTING holds open directory listings */
typedef struct {
    BYTE *listing;       /* pointer to directory listing */
    size_t listing_size; /* how many bytes has listing? */
    time_t mtime;        /* when cache was build */
} DIRLISTING;

/* hold directory information */
typedef struct {
    char *realname;           /* real directory name, full path resolved */
    IPrange *owner;           /* owners of this directory */
    unsigned char protection; /* directory protection flags */
    char *public_password;    /* password for file access */
    char *owner_password;     /* password for owners */
    char *readme;             /* readme content */
    time_t mtime;             /* directory last modified time */
    time_t lastcheck;         /* when the directory was last stat()-ed */
} DIRINFO;

#define REVERSE_ERR_MSG "Permission denied -- can't identify host.\n\
  Sorry, we can't reverse name you.  If you know that your site normally\n\
  can be, try again in a few minutes when the local maps may have been\n\
  updated.  Otherwise, this service is unavailable to you; check\n\
  with your local admins for as to why this is the case.\n"

/* definition of logging information */
#define L_NONE		0x0000
#define L_ERR		0x0001
#define L_VER		0x0002
#define L_GETDIR	0x0004
#define L_GETFILE	0x0008
#define L_UPLOAD	0x0010
#define L_INSTALL	0x0020
#define L_DELFILE	0x0040
#define L_DELDIR	0x0080
#define L_SETPRO	0x0100
#define L_MAKEDIR	0x0200
#define L_GRABFILE	0x0400
#define L_GETPRO	0x0800
#define L_RDONLY	0x1000
#define L_STAT		0x2000
#define L_RENAME	0x4000
#define L_ALL		0xffff

/* cache directory listing */
#define FSP_DIRLISTING ".FSP_CONTENT"
/* file names used for access control */
#define FSP_NOGET ".FSP_NO_GET"
#define FSP_DEL ".FSP_OK_DEL"
#define FSP_ADD ".FSP_OK_ADD"
#define FSP_MKDIR ".FSP_OK_MKDIR"
#define FSP_RENAME ".FSP_OK_RENAME"
#define FSP_NOLIST ".FSP_NO_LIST"
#define FSP_OWNER ".FSP_OWNER"
#define FSP_PASSWORD ".FSP_OK_PASSWORD"
#define FSP_OWNERPASSWORD ".FSP_OWNER_PASSWORD"

#endif /* _FSP_SERVER_DEF_H_ */