kom-types.h 16.8 KB
Newer Older
Linus Tolke Y's avatar
Linus Tolke Y committed
1
/*
Per Cederqvist's avatar
Per Cederqvist committed
2
 * $Id: kom-types.h,v 0.10 1993/10/18 12:03:58 ceder Exp $
Linus Tolke Y's avatar
Linus Tolke Y committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 * Copyright (C) 1991  Lysator Academic Computer Association.
 *
 * This file is part of the LysKOM server.
 * 
 * LysKOM is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 1, or (at your option) 
 * any later version.
 * 
 * LysKOM is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with LysKOM; see the file COPYING.  If not, write to
 * Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
 * or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
 * MA 02139, USA.
 *
 * Please mail bug reports to bug-lyskom@lysator.liu.se. 
 */
Per Cederqvist's avatar
.  
Per Cederqvist committed
25 26 27 28 29 30 31 32 33 34 35
/*
 *  KOM-types.h  --  Types used by both server and client of LysKOM
 *
 *
 *  Copyright (C) 1990	Lysator Computer Club,
 *			Linkoping University,  Sweden
 *
 *  Everyone is granted permission to copy, modify and redistribute
 *  this code, provided the people they give it to can.
 *
 *
36 37 38 39
 *  Filecreator: Thomas Bellman
 *		  Lysator Computer Club
 *		  Linkoping University
 *		  Sweden
Per Cederqvist's avatar
.  
Per Cederqvist committed
40
 *
41
 *  email:	  Bellman@Lysator.LiU.SE
Per Cederqvist's avatar
.  
Per Cederqvist committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
 */



#ifndef  KOM_TYPES_H_ALREADY_INCLUDED__

#define  KOM_TYPES_H_ALREADY_INCLUDED__

#ifndef SERVER
# ifndef CLIENT
#  error must define SERVER or CLIENT
# endif
#else
# ifdef CLIENT
#  error must not define both SERVER and CLIENT
# endif
#endif /* !SERVER */


Per Cederqvist's avatar
Per Cederqvist committed
61 62 63 64 65
typedef unsigned short Pers_no;
typedef unsigned short Conf_no;
typedef unsigned long  Text_no;
typedef unsigned long  Local_text_no;
typedef unsigned long  Session_no;
Per Cederqvist's avatar
.  
Per Cederqvist committed
66

67 68 69 70 71 72 73 74 75 76
#ifdef PROT_a

/*
 * To uniquely identify a person, conference or text, three numbers
 * are used: Universe, Site and X_{recpt,person,text}. The universe is
 * omitted when it is LysKOM, or is implied by a echo conference.
 */
/*
 * LysKOM, RFC-822, FidoNet, News are examples of universes.
 */
77
/*typedef		unsigned long		Universe;*/
78 79 80 81 82 83

/*
 * JAKOM, lysator.liu.se, 2:504/113, foo.bar.com are examples of sites
 * in the above universes. (Note that comp.lang.c is _not_ a site in
 * the News universe).
 */
84
/*typedef		unsigned long		Site;*/
85 86 87 88 89 90 91 92 93 94 95

/*
 * Fritt Forum, ceder, Per Cederqvist, comp.lang.c are examples of
 * x_recpt in the above universes.
 */

/*
 * But for now, we have a System_id (sum of Universe and Site) and a
 * Global_x.
 */

96 97 98 99
typedef		unsigned long		System_id;
typedef		unsigned long		Global_recpt;
typedef		unsigned long		Global_person;
typedef		unsigned long		Global_text;
100 101 102 103

#endif


Per Cederqvist's avatar
.  
Per Cederqvist committed
104 105 106 107 108 109
#define	MAX_PERS_NO		((Pers_no) USHRT_MAX)
#define MAX_CONF_NO		((Conf_no) USHRT_MAX)
#define MAX_TEXT_NO		((Text_no) ULONG_MAX)
#define	MAX_LOCAL_TEXT_NO	((Local_text_no) ULONG_MAX)


Per Cederqvist's avatar
Per Cederqvist committed
110 111 112 113 114 115
#ifdef SERVER
#  define         PASSWD_LEN 64
   typedef char	  Password[PASSWD_LEN];
   typedef off_t  Text_index;
   typedef time_t Time;
#  define NULL_TIME_i	0
Per Cederqvist's avatar
.  
Per Cederqvist committed
116
#else	/* CLIENT */
Per Cederqvist's avatar
Per Cederqvist committed
117 118 119
   typedef struct tm Time;
#  define NULL_TIME_i   {0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
#endif /* CLIENT */
Per Cederqvist's avatar
.  
Per Cederqvist committed
120 121 122 123 124 125 126 127 128



/*
 * The privilige bits:  says what priviliges a person has.  E g
 *  if he is allowed to read texts he normally shouldn't be allowed
 *  to read. See file doc/security-levels.txt
 */
typedef	struct {
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
	unsigned int	wheel	: 1;
	unsigned int	admin	: 1;
	unsigned int	statistic : 1;
	unsigned int	create_pers: 1;
	unsigned int	create_conf: 1;
	unsigned int	change_name: 1;
	unsigned int	extern_gw : 1;
	unsigned int	flg8	: 1;	/* For future use. */
	unsigned int	flg9    : 1;
	unsigned int	flg10   : 1;
	unsigned int	flg11   : 1;
	unsigned int	flg12	: 1;
	unsigned int	flg13	: 1;
	unsigned int	flg14	: 1;
	unsigned int	flg15	: 1;
	unsigned int	flg16	: 1;
Per Cederqvist's avatar
.  
Per Cederqvist committed
145 146 147
} Priv_bits;

#ifdef SERVER
Per Cederqvist's avatar
Per Cederqvist committed
148
#  define DEFAULT_PRIV_BITS_i					\
Per Cederqvist's avatar
.  
Per Cederqvist committed
149 150 151 152
	{	0, 0, 0, ANYONE_CAN_CREATE_NEW_PERSONS,		\
		ANYONE_CAN_CREATE_NEW_CONFS,			\
		DEFAULT_CHANGE_NAME, 0, 0, 0, 0, 0,		\
		0, 0, 0, 0, 0					\
Per Cederqvist's avatar
Per Cederqvist committed
153
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
154
#else
Per Cederqvist's avatar
Per Cederqvist committed
155
#	define DEFAULT_PRIV_BITS_i				\
Per Cederqvist's avatar
.  
Per Cederqvist committed
156 157
	{	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,		\
		0, 0, 0, 0, 0					\
Per Cederqvist's avatar
Per Cederqvist committed
158
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
159 160 161 162 163 164 165 166 167
#endif
extern  const Priv_bits		DEFAULT_PRIV_BITS;



/*
 * Flags in the Person struct.
 */
typedef struct {
Per Cederqvist's avatar
Per Cederqvist committed
168 169
    unsigned int  unread_is_secret : 1;/* FALSE if everyone is allowed to ask
					  how many unread texts you have. */
170 171 172 173 174 175 176
    unsigned int  flg2	: 1;
    unsigned int  flg3	: 1;
    unsigned int  flg4	: 1;
    unsigned int  flg5	: 1;
    unsigned int  flg6	: 1;
    unsigned int  flg7	: 1;
    unsigned int  flg8	: 1;
Per Cederqvist's avatar
.  
Per Cederqvist committed
177 178
} Personal_flags;

Per Cederqvist's avatar
Per Cederqvist committed
179
#define DEFAULT_PERSONAL_FLAGS_i   { 0, 0, 0, 0, 0, 0, 0, 0 }
Per Cederqvist's avatar
.  
Per Cederqvist committed
180

Per Cederqvist's avatar
Per Cederqvist committed
181
extern const Personal_flags DEFAULT_PERSONAL_FLAGS;
Per Cederqvist's avatar
.  
Per Cederqvist committed
182 183 184


/* See file doc/misc_items */
185 186 187 188 189 190 191 192 193
typedef enum {
    recpt     = 0,	/* 0 Recipient (conference) */
    cc_recpt  = 1,	/* 1 Carbon Copy recipient (extra kopia) */
    comm_to   = 2,	/* 2 Comment to (text) */
    comm_in   = 3,	/* 3 Commented in (text) */
    footn_to  = 4,	/* 4 This is a footnote to (text) */
    footn_in  = 5,	/* 5 Footnote to this text in (text) */
#ifdef PROT_a
    x_author  = 10,	/* 10 External author (Global_name). */
Per Cederqvist's avatar
.  
Per Cederqvist committed
194 195
#endif
    
196 197 198 199 200 201 202 203 204 205 206
    loc_no    = 6,	/* 6 Sequence number within conference */
    rec_time  = 7,	/* 7 Received at (time) */
    sent_by   = 8,	/* 8 Sent by (person) */
    sent_at   = 9	/* 9 Sent at (time) */
#ifdef PROT_a
	,
    x_person  = 11,	/* 11 External person id. (Global_name). */
    x_recpt   = 12,	/* 12 External recipient. (Global_name). */
    x_text    = 13,	/* 13 External text. (Global_text). */
    x_system  = 14	/* 14 External system identification (System_id). */
#endif
Per Cederqvist's avatar
.  
Per Cederqvist committed
207 208
} Info_type;

209 210 211 212
#ifdef PROT_a
typedef String Global_name;
#endif

Per Cederqvist's avatar
.  
Per Cederqvist committed
213 214 215 216 217 218 219
typedef	union {
		Conf_no		recipient;
		Conf_no		cc_recipient;
		Text_no		comment_to;
		Text_no		commented_in;
		Text_no		footnote_to;
		Text_no		footnoted_in;
220 221 222 223 224 225 226

#ifdef PROT_a
		Global_name	x_author; /* Protocol a. */
#endif

		Local_text_no	local_no;
		Time		received_at;
Per Cederqvist's avatar
.  
Per Cederqvist committed
227 228
		Pers_no		sender;
		Time		sent_at;
229 230 231 232 233 234 235

#ifdef PROT_a
		Global_name	global_person;
		Global_name	global_recpt;
		Global_text	global_text;
		System_id	system_id;
#endif
Per Cederqvist's avatar
.  
Per Cederqvist committed
236 237 238 239 240 241 242 243 244 245 246 247 248
} Info_datum;


/*  This struct contains miscellaneous information about a text.  */
typedef	struct {
	Info_type	type;
	Info_datum	datum;
} Misc_info;


/*  Fields of this type is supposed to tell the garbage collector
 *  which texts it should remove first.
 */
249
typedef unsigned long	Garb_nice;
Per Cederqvist's avatar
.  
Per Cederqvist committed
250 251 252 253 254 255 256 257 258


/*  Struct for text status  */
typedef struct {
	Time		  creation_time;
#ifdef SERVER
        long              file_pos; /* Start of the text in the text file. */
#endif
	Pers_no		  author;
259
	unsigned short		  no_of_lines;
Per Cederqvist's avatar
.  
Per Cederqvist committed
260
	String_size	  no_of_chars;
261 262
	unsigned short		  no_of_marks;	/* Antal markeringar */
	unsigned short		  no_of_misc;	/* Recipients, times, comments, ... */
Per Cederqvist's avatar
.  
Per Cederqvist committed
263 264 265 266
	Misc_info	* misc_items;	/* List of miscellaneous info. */
} Text_stat;

#ifdef SERVER
Per Cederqvist's avatar
Per Cederqvist committed
267
#  define  EMPTY_TEXT_STAT_i  {  NULL_TIME_i, 0, 0, 0, 0, 0, 0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
268
#else
Per Cederqvist's avatar
Per Cederqvist committed
269
#  define  EMPTY_TEXT_STAT_i  {  NULL_TIME_i, 0, 0, 0, 0, 0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
270 271 272 273 274 275
#endif

extern const Text_stat EMPTY_TEXT_STAT;


typedef	struct {
Per Cederqvist's avatar
Per Cederqvist committed
276 277 278 279 280 281 282 283 284 285 286
	unsigned int	rd_prot	: 1;	/* !(Can anyone become a member?) */
	unsigned int	original : 1;	/* Comments forbidden? */
	unsigned int	secret : 1;	/* Secret conference? */
				/* Note: if a letterbox is secret it
				 * will be very hard for that person
				 * to log in, since he can't map his
				 * name to a pers_no. He must either
				 * know his pers_no, or have another
				 * identity which is his supervisor.
				 */
	unsigned int	letter_box : 1;	/* Is this a letter box? */
Per Cederqvist's avatar
.  
Per Cederqvist committed
287 288
} Conf_type;

Per Cederqvist's avatar
Per Cederqvist committed
289
#define	NULL_CONF_TYPE_i   {  0, 0, 0, 0  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
290

Per Cederqvist's avatar
Per Cederqvist committed
291
extern  const Conf_type	NULL_CONF_TYPE;
Per Cederqvist's avatar
.  
Per Cederqvist committed
292 293 294 295 296 297 298 299 300 301


typedef struct {
	Pers_no		member;
} Member;


/* Struct for marks */
typedef struct {
	Text_no		text_no;
Per Cederqvist's avatar
Per Cederqvist committed
302
	unsigned char	mark_type;	/* It's up to the clients to decide the
Per Cederqvist's avatar
.  
Per Cederqvist committed
303 304 305 306 307 308 309 310
					   meaning of this field. */
} Mark;



/*  Information about a person's membership in a conference  */
typedef struct {
	Conf_no		conf_no;
Per Cederqvist's avatar
Per Cederqvist committed
311
	unsigned char	priority;	/* Interrupt priority */
Per Cederqvist's avatar
.  
Per Cederqvist committed
312 313 314 315
	Time		last_time_read;	/* Updated every time a text in this
					   conf. is marked as read.	*/
	Local_text_no	last_text_read;	/* All texts before and inclusive this
					   are read	*/
Per Cederqvist's avatar
Per Cederqvist committed
316
	unsigned short	no_of_read;
Per Cederqvist's avatar
.  
Per Cederqvist committed
317 318 319 320
	Local_text_no * read_texts;	/* Texts after last_text_read. Sorted
					   in ascending order */
} Membership;

Per Cederqvist's avatar
Per Cederqvist committed
321
#define	EMPTY_MEMBERSHIP_i  { 0, 0, NULL_TIME_i, 0, 0, NULL }
Per Cederqvist's avatar
.  
Per Cederqvist committed
322

Per Cederqvist's avatar
Per Cederqvist committed
323
extern  const Membership EMPTY_MEMBERSHIP;
Per Cederqvist's avatar
.  
Per Cederqvist committed
324 325 326 327 328


/* Some structs to handle variable-sized arrays. */

typedef struct {
329
	unsigned short	  no_of_marks;
Per Cederqvist's avatar
.  
Per Cederqvist committed
330 331 332
	Mark	* marks;		/* Pointer to an array of marks. */
} Mark_list;

Per Cederqvist's avatar
Per Cederqvist committed
333 334
#define	EMPTY_MARK_LIST_i  {  0, NULL  }

Per Cederqvist's avatar
.  
Per Cederqvist committed
335 336 337 338
extern const Mark_list EMPTY_MARK_LIST;


typedef struct {
339
    unsigned short no_of_confs;
Per Cederqvist's avatar
.  
Per Cederqvist committed
340 341 342
    Conf_no  *conf_nos;
} Conf_no_list;

Per Cederqvist's avatar
Per Cederqvist committed
343
#define EMPTY_CONF_NO_LIST_i  { 0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
344 345 346 347
extern const Conf_no_list EMPTY_CONF_NO_LIST;
   

typedef struct {
348
	unsigned short	  no_of_members;
Per Cederqvist's avatar
.  
Per Cederqvist committed
349 350 351
	Member	* members;
} Member_list;

Per Cederqvist's avatar
Per Cederqvist committed
352
#define EMPTY_MEMBER_LIST_i  {  0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
353 354 355 356 357
extern const Member_list EMPTY_MEMBER_LIST;


typedef  struct {
	Local_text_no	  first_local_no;
358
    	unsigned long		  no_of_texts;
Per Cederqvist's avatar
.  
Per Cederqvist committed
359 360 361
	Text_no		* texts;
}  Text_list;

Per Cederqvist's avatar
Per Cederqvist committed
362
#define EMPTY_TEXT_LIST_i  {  1, 0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
363 364 365 366 367 368 369 370
extern const Text_list	EMPTY_TEXT_LIST;



/*  A list of conference numbers, also telling if it is a
 *  mailbox (i e a person) or an ordinary conference.	*/
/* Delete this ugly variant as soon as possible! */
typedef struct {
371
	unsigned long		  no_of_conf_nos;
Per Cederqvist's avatar
.  
Per Cederqvist committed
372 373 374 375 376 377 378 379 380 381
	Conf_no		* conf_nos;
	Conf_type	* type_of_conf;
} Conf_list_old;
/* This is the way it should look! */
typedef struct {
	Conf_no   conf_no;
	Conf_type type;
} Micro_conf;

typedef struct {
382
	unsigned long       no_of_confs;
Per Cederqvist's avatar
.  
Per Cederqvist committed
383 384 385 386
	Micro_conf * confs;
} Conf_list;


Per Cederqvist's avatar
Per Cederqvist committed
387
#define EMPTY_CONF_LIST_OLD_i	{ 0, NULL, NULL }
Per Cederqvist's avatar
.  
Per Cederqvist committed
388 389
extern const Conf_list_old	EMPTY_CONF_LIST_OLD;

Per Cederqvist's avatar
Per Cederqvist committed
390
#define EMPTY_CONF_LIST_i	{ 0, NULL }
Per Cederqvist's avatar
.  
Per Cederqvist committed
391 392 393 394 395
extern const Conf_list		EMPTY_CONF_LIST;


/*  A list of person numbers  */
typedef struct {
396
	unsigned long		  no_of_persons;
Per Cederqvist's avatar
.  
Per Cederqvist committed
397 398 399
	Pers_no		* persons;
} Pers_list;

Per Cederqvist's avatar
Per Cederqvist committed
400
#define EMPTY_PERS_LIST_i	{ 0, NULL }
Per Cederqvist's avatar
.  
Per Cederqvist committed
401 402 403 404 405
extern  const Pers_list		EMPTY_PERS_LIST;



typedef struct {
406
	unsigned short	      no_of_confs;
Per Cederqvist's avatar
.  
Per Cederqvist committed
407 408 409
	Membership  * confs;
} Membership_list;

Per Cederqvist's avatar
Per Cederqvist committed
410
#define EMPTY_MEMBERSHIP_LIST_i		{ 0, NULL }
Per Cederqvist's avatar
.  
Per Cederqvist committed
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
extern  const Membership_list		EMPTY_MEMBERSHIP_LIST;


/* The Info struct */
typedef struct {
	long		version;
	Conf_no		conf_pres_conf; /* Presentation of new confs */
	Conf_no		pers_pres_conf;	/* Presentation of new persons */
	Conf_no		motd_conf; 	/* Conf that receive motds */
	Conf_no		kom_news_conf;  /* News about kom */
	Text_no		motd_of_lyskom; /* To be displayed after login */
	/* and maybe more... */
} Info;



typedef	struct {
	Pers_no		creator;
	Time		creation_time;
	Text_no		presentation;
	Conf_no		supervisor;	/* Organisat|r f|r m|tet */
	Conf_no		permitted_submitters;	/* People who are allowed
					   to submit texts to this conf. 
					   0 -> anyone may submit. */
	Conf_no		super_conf;	/* Send unallowed submissions to
					   the super_conf. 
					   0 -> unallowed submissions bounce */
	Conf_type	type;		/* secret, rd_prot etc */
	Time		last_written;	/* Time of latest text in this conf. */
	Text_no		msg_of_day;	/* Message to be displayed when this
					   conf is referenced by the user. */
	Garb_nice	nice;		/* How long do texts in this
					   conf live? */
	String		name;		/* Name of conference */
#ifdef CLIENT
446
	unsigned short		no_of_members;
Per Cederqvist's avatar
.  
Per Cederqvist committed
447
	Local_text_no	first_local_no;
448
	unsigned long		no_of_texts;
Per Cederqvist's avatar
.  
Per Cederqvist committed
449 450 451 452 453 454 455 456
#else
	Member_list	members;	/* List of members in conf */
	Text_list	texts;		/* List of texts */
#endif
} Conference;


#ifdef CLIENT
Per Cederqvist's avatar
Per Cederqvist committed
457
#  define  EMPTY_CONFERENCE_i \
Per Cederqvist's avatar
.  
Per Cederqvist committed
458 459
	{	0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i,	\
		NULL_TIME_i, 0, 0, EMPTY_STRING_i, 0, 0, 0	\
Per Cederqvist's avatar
Per Cederqvist committed
460
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
461
#else	/* SERVER */
Per Cederqvist's avatar
Per Cederqvist committed
462
#  define  EMPTY_CONFERENCE_i \
Per Cederqvist's avatar
.  
Per Cederqvist committed
463 464 465
	{	0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i,	\
		NULL_TIME_i, 0, 0, EMPTY_STRING_i,		\
		EMPTY_MEMBER_LIST_i, EMPTY_TEXT_LIST_i		\
Per Cederqvist's avatar
Per Cederqvist committed
466
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
467 468 469 470 471 472 473 474 475 476 477 478
#endif	/* SERVER */
extern const Conference	EMPTY_CONFERENCE;


#ifdef SERVER
typedef struct {
	String		name;		/* Name of conference */
	Conf_type	type;		/* secret, rd_prot etc */
	Local_text_no	highest_local_no; /* highest local text no */
	Garb_nice	nice;	        /* Number of days to live */
} Small_conf;

Per Cederqvist's avatar
Per Cederqvist committed
479
#define EMPTY_SMALL_CONF_i {EMPTY_STRING_i, NULL_CONF_TYPE_i, 0, 0};
Per Cederqvist's avatar
.  
Per Cederqvist committed
480
extern const Small_conf EMPTY_SMALL_CONF;
Per Cederqvist's avatar
Per Cederqvist committed
481
#endif /* SERVER */
Per Cederqvist's avatar
.  
Per Cederqvist committed
482 483 484 485 486 487 488 489 490
	

/*  Struct for persons  */
typedef struct {
	Text_no		user_area;	/* Misc info the clients might want to
					   store. 0 = not used. */
	Priv_bits	privileges;
	Personal_flags	flags;
	Time		last_login; 	/* Or logout */
491 492 493 494 495 496 497 498
	unsigned long		total_time_present; /* Number of seconds. */
	unsigned long		sessions;	/* Number of sessions */
	unsigned long		created_lines;	/* No. of created lines (statistics) */
	unsigned long		created_bytes;	/* No. of created bytes (statistics) */
	unsigned long		read_texts;	/* No. of read texts (statistics) */
	unsigned long		no_of_text_fetches; /* (statistics) */
	unsigned short		created_persons; /* (statistics) */
	unsigned short		created_confs;	/* (statistics) */
Per Cederqvist's avatar
.  
Per Cederqvist committed
499 500 501 502
	String		username;	/* User-name & hostname */
#ifdef CLIENT
	Local_text_no	first_created_text; /* The first text that still
					     * exists. */
503 504 505
	unsigned long		no_of_created_texts;
	unsigned short		no_of_marks;	/* This many marked texts */
	unsigned short		no_of_confs;	/* Member in this many confs */
Per Cederqvist's avatar
.  
Per Cederqvist committed
506 507 508 509 510 511 512 513 514 515
#else	/* SERVER */
	Text_list	created_texts;
	Mark_list	marks;		/* List of marked texts */
	Membership_list conferences;	/* List of conferences the person is
					 * a member in. */
	Password	pwd;		/* Encrypted password */
#endif
} Person;

#ifdef SERVER
Per Cederqvist's avatar
Per Cederqvist committed
516
#  define EMPTY_PERSON_i \
Per Cederqvist's avatar
.  
Per Cederqvist committed
517 518 519 520 521
	{	0, DEFAULT_PRIV_BITS_i,				\
		DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0,	\
		0, 0, 0, 0, 0, 0, EMPTY_STRING_i,		\
		EMPTY_TEXT_LIST_i, EMPTY_MARK_LIST_i,		\
		EMPTY_MEMBERSHIP_LIST_i, "\001password"		\
Per Cederqvist's avatar
Per Cederqvist committed
522
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
523
#else
Per Cederqvist's avatar
Per Cederqvist committed
524
#  define EMPTY_PERSON_i \
Per Cederqvist's avatar
.  
Per Cederqvist committed
525 526 527
	{	0, DEFAULT_PRIV_BITS_i,				\
		DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0,	\
		0, 0, 0, 0, 0, 0, EMPTY_STRING_i, 0, 0, 0, 0	\
Per Cederqvist's avatar
Per Cederqvist committed
528
	}
Per Cederqvist's avatar
.  
Per Cederqvist committed
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
#endif
extern  const Person	EMPTY_PERSON;


/*
 * This struct is returned from the 'who_is_on' call.
 */
typedef struct {
	Pers_no		person;
	String		what_am_i_doing;
	Conf_no		working_conference;
} Who_info_old;

typedef struct {
	Pers_no		person;
	String		what_am_i_doing;
	String		username;           /* Userid and hostname. */
	Conf_no		working_conference;
	Session_no	session_no;         /* Serial number of connection. */
} Who_info;

550 551 552 553 554 555 556 557 558 559
typedef struct {
	Pers_no		person;
	String		what_am_i_doing;
	String		username;           /* Userid and hostname. */
	String		ident_user;	     /* According to Ident protocol. */
	String		hostname; 	     /* According to TCP/IP. */
	Conf_no		working_conference;
	Session_no	session_no;         /* Serial number of connection. */
} Who_info_ident;

Per Cederqvist's avatar
Per Cederqvist committed
560 561
#define	EMPTY_WHO_INFO_IDENT_i \
  {  0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
562 563
extern const Who_info_ident    EMPTY_WHO_INFO_IDENT;

Per Cederqvist's avatar
.  
Per Cederqvist committed
564 565 566 567 568 569 570
typedef struct {
	Pers_no		person;
	String		what_am_i_doing;
	String		username;            /* Userid and hostname. */
	Conf_no		working_conference;
	Session_no	session;             /* Serial number of connection. */
	Time		connection_time;     /* Not logintime. */
571
	unsigned long		idle_time; 	     /* Seconds. */
Per Cederqvist's avatar
.  
Per Cederqvist committed
572 573
} Session_info;

Per Cederqvist's avatar
Per Cederqvist committed
574 575 576
#define EMPTY_SESSION_INFO_i { 0, EMPTY_STRING_i,    \
				 EMPTY_STRING_i, 0, 0, \
				 NULL_TIME_i, 0 }
Per Cederqvist's avatar
.  
Per Cederqvist committed
577 578 579

extern const Session_info	EMPTY_SESSION_INFO;

580 581 582 583 584 585 586 587 588 589
typedef struct {
	Pers_no		person;
	String		what_am_i_doing;
	String		username;            /* Userid and hostname,
						according to the client. */
	String		ident_user;	     /* According to Ident protocol. */
	String		hostname; 	     /* According to TCP/IP. */
	Conf_no		working_conference;
	Session_no	session;             /* Serial number of connection. */
	Time		connection_time;     /* Not logintime. */
590
	unsigned long		idle_time; 	     /* Seconds. */
591 592
} Session_info_ident;

Per Cederqvist's avatar
Per Cederqvist committed
593
#define EMPTY_SESSION_INFO_IDENT_i \
594 595
		 { 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i,   \
	           EMPTY_STRING_i, 0, 0, \
Per Cederqvist's avatar
Per Cederqvist committed
596
		   NULL_TIME_i, 0 }
597 598 599

extern const Session_info_ident	EMPTY_SESSION_INFO_IDENT;

Per Cederqvist's avatar
Per Cederqvist committed
600 601
#define	EMPTY_WHO_INFO_OLD_i	{  0, EMPTY_STRING_i, 0 }
#define	EMPTY_WHO_INFO_i	{  0, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
Per Cederqvist's avatar
.  
Per Cederqvist committed
602 603 604 605 606 607 608 609 610 611 612

extern const Who_info_old	EMPTY_WHO_INFO_OLD;
extern const Who_info		EMPTY_WHO_INFO;



typedef struct {
	int		  no_of_persons;
    	Who_info_old	* info;
} Who_info_list_old;	

Per Cederqvist's avatar
Per Cederqvist committed
613 614
#define EMPTY_WHO_INFO_LIST_OLD_i {  0, NULL  }
extern const Who_info_list_old	  EMPTY_WHO_INFO_LIST_OLD;
Per Cederqvist's avatar
.  
Per Cederqvist committed
615 616 617 618 619 620 621


typedef struct {
	int		  no_of_persons;
    	Who_info	* info;
} Who_info_list;	

Per Cederqvist's avatar
Per Cederqvist committed
622
#define EMPTY_WHO_INFO_LIST_i	{  0, NULL  }
Per Cederqvist's avatar
.  
Per Cederqvist committed
623 624
extern const Who_info_list	EMPTY_WHO_INFO_LIST;

625 626 627 628 629
typedef struct {
	int		  no_of_persons;
    	Who_info_ident	* info;
} Who_info_ident_list;

Per Cederqvist's avatar
Per Cederqvist committed
630
#define EMPTY_WHO_INFO_IDENT_LIST_i	{  0, NULL  }
631 632
extern const Who_info_ident_list	EMPTY_WHO_INFO_IDENT_LIST;

Per Cederqvist's avatar
Per Cederqvist committed
633
#define EMPTY_tm_i	{0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
Per Cederqvist's avatar
.  
Per Cederqvist committed
634 635

#endif	/*  ifndef  KOM_TYPES_H_ALREADY_INCLUDED__  */