File: server.h

package info (click to toggle)
youbin 3.4-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,652 kB
  • ctags: 1,234
  • sloc: ansic: 5,882; makefile: 584; sh: 24
file content (164 lines) | stat: -rw-r--r-- 4,209 bytes parent folder | download
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
 * Program:     $RCSfile: server.h,v $  $Revision: 4.6 $
 *
 * Purpose:     Header file of the Internet "youbin" service.
 *
 * Author:      K.Agusa     agusa@nuie.nagoya-u.ac.jp
 *              S.Yamamoto  yamamoto@nuie.nagoya-u.ac.jp
 *
 * Date:        1993/07/24
 * Modified:    $Date: 1995/03/26 13:39:35 $
 *
 * Copyright:   K.Agusa and S.Yamamoto  1993 - 1995
 *
 * The X Consortium, and any party obtaining a copy of these files from
 * the X Consortium, directly or indirectly, is granted, free of charge,
 * a full and unrestricted irrevocable, world-wide, paid up, royalty-free,
 * nonexclusive right and license to deal in this software and documentation
 * files (the "Software"), including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons who receive copies from any such
 * party to do so. This license includes without limitation a license to do
 * the foregoing actions under any patents of the party supplying this
 * software to the X Consortium.
 */

/*
 *                  Constant definitions.
 */

#ifndef MAIL_SPOOL
#ifdef SVR4 
#define MAIL_SPOOL          "/usr/mail/"
#elif defined(__FreeBSD__)
#include <paths.h>
#define MAIL_SPOOL     _PATH_MAILDIR "/"
#else
#define MAIL_SPOOL          "/usr/spool/mail/"
#endif
#endif /* not MAIL_SPOOL */

#define BASIC_HEAD "Body,From:,To:,Subject:,cc:,Date:"

/*
 *                  Type definitions.
 */

enum   vecs     {ACKED, IDLE, WAIT, TO1, TO2, NOT_USED, PW1, PW2, DUMMY_NOT_USED};
enum   a_mode   {NONE, PLAIN, ROK, PGP};

typedef struct _State       *StateP;
typedef struct _User        *UserP;

typedef struct _State {
    enum vecs           state;
    SockAddr            ca;
    union {
      enum     a_mode   auth_mode;  /* Auth_mode and Biff_mode. */
      unsigned int      head_list;
          }             mode;
    struct {
      unsigned int      no_KeepAlive: 1; /* 1 means no keep alive request */
#ifdef VER2_BC
      unsigned int      ver2_user: 1;    /* 1 means this user uses ver2 protocol */
#endif
          }             option;
    UserP               parent;     /* To name structure. */
    StateP              next;       /* If someone requests twice. */
} State;

typedef struct _User {
    char            name[USER_NAME_LEN];
    long            size;           /* Size of user mail spool file. */
    long            time;           /* Date of user mail spool file. */
    StateP          stat;           /* Pointer to State. */
    UserP           next;           /* Link to next User. */
} User;

/*
 *                  External variables.
 */

extern char         *NAK_reason;
extern char         NAK_buff[MESS_LEN + 1];
extern SockAddr     ca;

/* List structures. */

extern UserP        UserAlist;
extern User         UserList;
extern StateP       StateAlist;

/*
 *                  Function declarations.
 */

void        check_spool();
void        get_mess();
void        init();
int         open_udp();
void        print_addr();

void        do_Wakeup();
void        send_PREQ();
void        send_packet();
void        send_Quit();

void        periodic();

void        sig_quit();
void        sig_hup();
void        sig_alarm();

/*
 *                  Function declarations: "list.c".
 */

int         is_trusted_user();
int         check_ca();

void        init_users();
StateP      make_user();
UserP       find_user();
UserP       new_user();
void        dispose_user();
void        del_state();

StateP      new_state();
void        dispose_state();
StateP      get_id();

/*
 *     Function declarations: "misc.c"
 */
void parse_mess();

/*
 *                  Function declarations: "log.c".
 */

/*
 * Variable argument list.
 */

#ifdef USE_STDARG 

void        debug_log(char *, ...);
void        warn_log(char *, ...);
void        info_log(char *, ...);
void        error_log(char *, ...);
void        trace(char *, ...);

#else /* USE_VARARGS */

void        debug_log();
void        warn_log();
void        info_log();
void        error_log();
void        trace();

#endif /* USE_VARARGS */

void        init_log();
void        sys_error_log();
void        output_log();