prot-a-output.c 16.7 KB
Newer Older
Linus Tolke's avatar
Linus Tolke committed
1
/*
2
 * $Id: prot-a-output.c,v 0.21 1996/07/24 23:57:32 ceder Exp $
3
 * Copyright (C) 1991, 1992, 1993, 1994, 1995  Lysator Academic Computer Association.
Linus Tolke's avatar
Linus Tolke committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * 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
/*
 * prot-a-output.c  -  write objects through a mux connection.
 *
 * Written by ceder 1990-07-13
 */

31
static char *rcsid = "$Id: prot-a-output.c,v 0.21 1996/07/24 23:57:32 ceder Exp $";
32
33
#include "rcs.h"
USE(rcsid);
Per Cederqvist's avatar
Per Cederqvist committed
34

Per Cederqvist's avatar
Per Cederqvist committed
35
#include <time.h>
Per Cederqvist's avatar
Per Cederqvist committed
36
#include <setjmp.h>
37
38
39
40
41
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_STDARG_H
#  include <stdarg.h>
#endif
Per Cederqvist's avatar
Per Cederqvist committed
42

43
#include "s-string.h"
Per Cederqvist's avatar
Per Cederqvist committed
44
45
#include "kom-types.h"
#include "isc-interface.h"
Per Cederqvist's avatar
Per Cederqvist committed
46
#include "com.h"
47
#include "async.h"
Per Cederqvist's avatar
Per Cederqvist committed
48
49
#include "connections.h"
#include "mux.h"
Per Cederqvist's avatar
Per Cederqvist committed
50
51
#include "prot-a-output.h"
#include "lyskomd.h"
Per Cederqvist's avatar
Per Cederqvist committed
52
53
54
55
56
57
58
59
60
61
62
63

void
prot_a_output_person (Connection *fp,
		      Person *person)
{
    prot_a_output_string (fp, person->username);
    prot_a_output_priv_bits (fp, person->privileges);
    prot_a_output_personal_flags (fp, person->flags);

    prot_a_output_time(fp, person->last_login);

    mux_printf (fp, " %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
64
65
	     (unsigned long) person -> user_area,
	     (unsigned long) person -> total_time_present, /* This is not a time,
Per Cederqvist's avatar
Per Cederqvist committed
66
67
						     * but a number of seconds.
						     */
68
69
70
71
72
73
74
75
76
77
78
	     (unsigned long) person -> sessions,
	     (unsigned long) person -> created_lines,
	     (unsigned long) person -> created_bytes,
	     (unsigned long) person -> read_texts,
	     (unsigned long) person -> no_of_text_fetches,
	     (unsigned long) person -> created_persons,
	     (unsigned long) person -> created_confs,
	     (unsigned long) person -> created_texts.first_local_no,
	     (unsigned long) person -> created_texts.no_of_texts,
	     (unsigned long) person -> marks.no_of_marks,
	     (unsigned long) person -> conferences.no_of_confs);
Per Cederqvist's avatar
Per Cederqvist committed
79
80
81
82
83
84
85
86
87
88
89
}

void
prot_a_output_membership(Connection *fp,
			 const Membership *mship)
{
    int i;
    
    prot_a_output_time(fp, mship->last_time_read );
    
    mux_printf(fp, " %lu %lu %lu %lu",
90
91
92
93
	    (unsigned long)mship->conf_no,
	    (unsigned long)mship->priority,
	    (unsigned long)mship->last_text_read,
	    (unsigned long)mship->no_of_read);
Per Cederqvist's avatar
Per Cederqvist committed
94
95
96
97
98
    
    if ( mship->read_texts != NULL && mship->no_of_read > 0)
    {
	mux_printf(fp, " {");
	for ( i = 0; i < mship->no_of_read; i++)
99
	    mux_printf(fp, " %lu", (unsigned long)mship->read_texts[ i ]);
Per Cederqvist's avatar
Per Cederqvist committed
100
101
102
103
104
105
106
107
108
109
110
111
112
113
	
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

	
void
prot_a_output_membership_list (Connection	* fp,
			       Membership_list	  mlist)
{
    int i;
    
114
    mux_printf(fp, " %lu", (unsigned long)mlist.no_of_confs);
Per Cederqvist's avatar
Per Cederqvist committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

    if ( mlist.confs != NULL && mlist.no_of_confs > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < mlist.no_of_confs; i++)
	    prot_a_output_membership(fp, mlist.confs + i);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}


void
prot_a_output_conf_list(Connection *fp,
			Conf_list_old conf_list)
{
    int i;

134
    mux_printf(fp, " %lu", (unsigned long)conf_list.no_of_conf_nos);
Per Cederqvist's avatar
Per Cederqvist committed
135
136
137
138
    if ( conf_list.conf_nos != NULL && conf_list.no_of_conf_nos > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < conf_list.no_of_conf_nos; i++ )
139
	    mux_printf(fp, " %lu", (unsigned long)conf_list.conf_nos[ i ]);
Per Cederqvist's avatar
Per Cederqvist committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");

    if ( conf_list.type_of_conf != NULL && conf_list.no_of_conf_nos > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < conf_list.no_of_conf_nos; i++ )
	    prot_a_output_conf_type(fp, conf_list.type_of_conf[ i ]);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

void
prot_a_output_conf_no_list(Connection *fp,
			   Conf_no_list conf_no_list)
{
    int i;

162
    mux_printf(fp, " %lu", (unsigned long)conf_no_list.no_of_confs);
Per Cederqvist's avatar
Per Cederqvist committed
163
164
165
166
    if ( conf_no_list.conf_nos != NULL && conf_no_list.no_of_confs > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < conf_no_list.no_of_confs; i++ )
167
	    mux_printf(fp, " %lu", (unsigned long)conf_no_list.conf_nos[ i ]);
Per Cederqvist's avatar
Per Cederqvist committed
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}
    

void
prot_a_output_conference (Connection *fp,
			  Conference *conf_c)
{
    prot_a_output_string(fp, conf_c->name);

    prot_a_output_conf_type(fp, conf_c->type);

    prot_a_output_time(fp, conf_c -> creation_time );
    prot_a_output_time(fp, conf_c -> last_written );

    mux_printf (fp, " %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
187
188
189
190
191
192
193
194
195
196
	     (unsigned long) conf_c -> creator,
	     (unsigned long) conf_c -> presentation,
	     (unsigned long) conf_c -> supervisor,
	     (unsigned long) conf_c -> permitted_submitters,
	     (unsigned long) conf_c -> super_conf,
	     (unsigned long) conf_c -> msg_of_day,
	     (unsigned long) conf_c -> nice,
	     (unsigned long) conf_c -> members.no_of_members,
	     (unsigned long) conf_c -> texts.first_local_no,
	     (unsigned long) conf_c -> texts.no_of_texts);
Per Cederqvist's avatar
Per Cederqvist committed
197
198
}

199
200
201
202
203
204
205
206
207
208
void prot_a_output_uconference(Connection *fp,
			       Small_conf *conf_c)
{
    prot_a_output_string(fp, conf_c -> name);
    prot_a_output_extended_conf_type(fp, conf_c -> type);
    mux_printf(fp, " %lu %lu",
	       (unsigned long) conf_c -> highest_local_no,
	       (unsigned long) conf_c -> nice);
}

Per Cederqvist's avatar
Per Cederqvist committed
209
210
211
212
213
214
215

void
prot_a_output_mark_list(Connection *fp,
			Mark_list mark_list)
{
    int i;

216
    mux_printf(fp, " %lu", (unsigned long)mark_list.no_of_marks);
Per Cederqvist's avatar
Per Cederqvist committed
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

    if ( mark_list.marks != NULL && mark_list.no_of_marks > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < mark_list.no_of_marks; i++ )
	    prot_a_output_mark(fp, mark_list.marks[ i ]);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
    
}


void
prot_a_output_text_stat(Connection *fp,
			Text_stat *t_stat)
{
    int i;

    prot_a_output_time(fp, t_stat->creation_time);
    
    mux_printf(fp, " %lu %lu %lu %lu %lu",
240
241
242
243
244
	    (unsigned long)t_stat->author,
	    (unsigned long)t_stat->no_of_lines,
	    (unsigned long)t_stat->no_of_chars,
	    (unsigned long)t_stat->no_of_marks,
	    (unsigned long)t_stat->no_of_misc);
Per Cederqvist's avatar
Per Cederqvist committed
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

    if ( t_stat->misc_items != NULL && t_stat->no_of_misc > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < t_stat->no_of_misc; i++ )
	    prot_a_output_misc_info(fp, t_stat->misc_items[ i ]);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}	


void
prot_a_output_text_list(Connection *fp,
			Text_list text_list)
{
    int i;

    mux_printf(fp, " %lu %lu",
265
266
	    (unsigned long)text_list.first_local_no,
	    (unsigned long)text_list.no_of_texts);
Per Cederqvist's avatar
Per Cederqvist committed
267
268
269
270
271

    if ( text_list.texts != NULL && text_list.no_of_texts > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < text_list.no_of_texts; i++ )
272
	    mux_printf(fp, " %lu", (unsigned long)text_list.texts[ i ]);
Per Cederqvist's avatar
Per Cederqvist committed
273
274
275
276
277
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}
278
279
280
281

static void
prot_a_output_who_info_ident(Connection *fp,
			     Who_info_ident *info)
Per Cederqvist's avatar
Per Cederqvist committed
282
283
{
    mux_printf(fp, " %lu %lu %lu",
284
285
286
	    (unsigned long)info->person,
	    (unsigned long)info->working_conference,
	    (unsigned long)info->session_no);
Per Cederqvist's avatar
Per Cederqvist committed
287
288
289

    prot_a_output_string(fp, info->what_am_i_doing);
    prot_a_output_string(fp, info->username);
290
291
292
293
294
    prot_a_output_string(fp, info->hostname);
    prot_a_output_string(fp, info->ident_user);
}


295
void
296
297
298
299
prot_a_output_who_info(Connection *fp,
		       Who_info *info)
{
    mux_printf(fp, " %lu %lu %lu",
300
301
302
	    (unsigned long)info->person,
	    (unsigned long)info->working_conference,
	    (unsigned long)info->session_no);
303
304

    prot_a_output_string(fp, info->what_am_i_doing); 
305
    prot_a_output_string(fp, info->username);
Per Cederqvist's avatar
Per Cederqvist committed
306
307
308
309
310
311
312
313
314
}


void
prot_a_output_who_info_list(Connection *fp,
			    Who_info_list info)
{
    int i;
    
315
    mux_printf(fp, " %lu", (unsigned long)info.no_of_persons);
Per Cederqvist's avatar
Per Cederqvist committed
316
317
318
319
320
321
322

    if ( info.info != NULL && info.no_of_persons > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < info.no_of_persons; i++ )
	{
	    prot_a_output_who_info(fp, &info.info[ i ]);
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
	    /* The username is specially alloced in who_is_on() in
	       session.c. */
	    s_clear(&info.info[i].username);
	}
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

void
prot_a_output_who_info_ident_list(Connection *fp,
				  Who_info_ident_list info)
{
    int i;
    
339
    mux_printf(fp, " %lu", (unsigned long)info.no_of_persons);
340
341
342
343
344
345
346

    if ( info.info != NULL && info.no_of_persons > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < info.no_of_persons; i++ )
	{
	    prot_a_output_who_info_ident(fp, &info.info[ i ]);
Per Cederqvist's avatar
Per Cederqvist committed
347
348
349
350
351
352
353
354
355
356
357
358
359
	}
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

void
prot_a_output_who_info_list_old(Connection *fp,
				Who_info_list_old info)
{
    int i;
    
360
    mux_printf(fp, " %lu", (unsigned long)info.no_of_persons);
Per Cederqvist's avatar
Per Cederqvist committed
361
362
363
364
365
366
367

    if ( info.info != NULL && info.no_of_persons > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < info.no_of_persons; i++ )
	{
	    mux_printf(fp, " %lu %lu",
368
369
		    (unsigned long)info.info[ i ].person,
		    (unsigned long)info.info[ i ].working_conference);
Per Cederqvist's avatar
Per Cederqvist committed
370
371
372
373
374
375
376
377
378
379
380
381
382
383
	    
	    prot_a_output_string(fp, info.info[ i ].what_am_i_doing);
	}
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

void
prot_a_output_session_info(Connection *fp,
			   Session_info *info)
{
    mux_printf(fp, " %lu %lu %lu",
384
385
386
	    (unsigned long)info->person,
	    (unsigned long)info->working_conference,
	    (unsigned long)info->session);
Per Cederqvist's avatar
Per Cederqvist committed
387
388
389
390

    prot_a_output_string(fp, info->what_am_i_doing);
    prot_a_output_string(fp, info->username);

391
    mux_printf(fp, " %lu", (unsigned long)info->idle_time);
Per Cederqvist's avatar
Per Cederqvist committed
392
393
    prot_a_output_time(fp, info->connection_time);
}
394
395
396

void
prot_a_output_session_info_ident(Connection *fp,
397
				 Session_info_ident *info)
398
399
{
    mux_printf(fp, " %lu %lu %lu",
400
401
402
	    (unsigned long)info->person,
	    (unsigned long)info->working_conference,
	    (unsigned long)info->session);
403
404
405
406
407
408

    prot_a_output_string(fp, info->what_am_i_doing);
    prot_a_output_string(fp, info->username);
    prot_a_output_string(fp, info->hostname);
    prot_a_output_string(fp, info->ident_user);

409
    mux_printf(fp, " %lu", (unsigned long)info->idle_time);
410
411
    prot_a_output_time(fp, info->connection_time);
}
Per Cederqvist's avatar
Per Cederqvist committed
412
413
414
415
416
417
    
void
prot_a_output_info(Connection *fp,
		   Info *info)
{
    mux_printf(fp, " %lu %lu %lu %lu %lu %lu",
418
419
420
421
422
423
	    (unsigned long)info->version,
	    (unsigned long)info->conf_pres_conf,
	    (unsigned long)info->pers_pres_conf,
	    (unsigned long)info->motd_conf,
	    (unsigned long)info->kom_news_conf,
	    (unsigned long)info->motd_of_lyskom);
Per Cederqvist's avatar
Per Cederqvist committed
424
425
426
427
428
429
430
}


extern void
prot_a_output_string(Connection *fp,
		     String str)
{
431
    mux_printf(fp, " %luH", (unsigned long)str.len);
Per Cederqvist's avatar
Per Cederqvist committed
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
    mux_write(fp, str.string, str.len);
}


extern void
prot_a_output_priv_bits(Connection *fp,
			Priv_bits bits)
{
    mux_putc(' ', fp);
    mux_putc(bits.wheel + '0', fp);
    mux_putc(bits.admin + '0', fp);
    mux_putc(bits.statistic + '0', fp);
    mux_putc(bits.create_pers + '0', fp);
    mux_putc(bits.create_conf + '0', fp);
    mux_putc(bits.change_name + '0', fp);
447
    mux_putc(bits.extern_gw + '0', fp);
Per Cederqvist's avatar
Per Cederqvist committed
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
    mux_putc(bits.flg8 + '0', fp);
    mux_putc(bits.flg9 + '0', fp);
    mux_putc(bits.flg10 + '0', fp);
    mux_putc(bits.flg11 + '0', fp);
    mux_putc(bits.flg12 + '0', fp);
    mux_putc(bits.flg13 + '0', fp);
    mux_putc(bits.flg14 + '0', fp);
    mux_putc(bits.flg15 + '0', fp);
    mux_putc(bits.flg16 + '0', fp);
}


extern void
prot_a_output_personal_flags(Connection *fp,
			     Personal_flags flags)
{
    mux_putc(' ', fp);
    mux_putc(flags.unread_is_secret + '0', fp);
    mux_putc(flags.flg2 + '0', fp);
    mux_putc(flags.flg3 + '0', fp);
    mux_putc(flags.flg4 + '0', fp);
    mux_putc(flags.flg5 + '0', fp);
    mux_putc(flags.flg6 + '0', fp);
    mux_putc(flags.flg7 + '0', fp);
    mux_putc(flags.flg8 + '0', fp);
}	

extern void
prot_a_output_conf_type(Connection *fp,
			Conf_type type)
{
    mux_putc(' ', fp);
    mux_putc(type.rd_prot + '0', fp);
    mux_putc(type.original + '0', fp);
    mux_putc(type.secret + '0', fp);
    mux_putc(type.letter_box + '0', fp);
}

486
487
488
489
490
491
492
493
494
495
496
497
498
499
extern void
prot_a_output_extended_conf_type(Connection *fp,
				 Conf_type type)
{
    mux_putc(' ', fp);
    mux_putc(type.rd_prot + '0', fp);
    mux_putc(type.original + '0', fp);
    mux_putc(type.secret + '0', fp);
    mux_putc(type.letter_box + '0', fp);
    mux_putc(type.anarchy + '0', fp);
    mux_putc(type.reserved1 + '0', fp);
    mux_putc(type.reserved2 + '0', fp);
    mux_putc(type.reserved3 + '0', fp);
}
Per Cederqvist's avatar
Per Cederqvist committed
500
501
502
503
504
505
506

extern void
prot_a_output_member_list(Connection *fp,
			  Member_list m_list)
{
    int i;

507
    mux_printf(fp, " %lu", (unsigned long)m_list.no_of_members);
Per Cederqvist's avatar
Per Cederqvist committed
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
    if ( m_list.members != NULL && m_list.no_of_members > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < m_list.no_of_members; i++ )
	    prot_a_output_member(fp, m_list.members[ i ]);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}


void
prot_a_output_member(Connection *fp,
		     Member member)
{
524
    mux_printf(fp, " %lu", (unsigned long)member.member);
Per Cederqvist's avatar
Per Cederqvist committed
525
526
527
528
529
530
531
}

    
extern void
prot_a_output_mark(Connection *fp,
		   Mark mark)
{
532
    mux_printf(fp, " %lu %lu", (unsigned long)mark.text_no, (unsigned long)mark.mark_type);
Per Cederqvist's avatar
Per Cederqvist committed
533
534
535
536
537
538
539
}


extern void
prot_a_output_misc_info(Connection *fp, 
			Misc_info misc)
{
540
    mux_printf(fp, " %lu", (unsigned long)misc.type);
Per Cederqvist's avatar
Per Cederqvist committed
541
542
543
544
    
    switch(misc.type)
    {
    case recpt:
545
	mux_printf(fp, " %lu", (unsigned long)misc.datum.recipient);
Per Cederqvist's avatar
Per Cederqvist committed
546
547
548
	break;
	
    case cc_recpt:
549
	mux_printf(fp, " %lu", (unsigned long)misc.datum.cc_recipient);
Per Cederqvist's avatar
Per Cederqvist committed
550
551
552
	break;
	
    case loc_no:
553
	mux_printf(fp, " %lu", (unsigned long)misc.datum.local_no);
Per Cederqvist's avatar
Per Cederqvist committed
554
555
556
557
558
559
560
	break;
	
    case rec_time:
	prot_a_output_time(fp, misc.datum.received_at);
	break;
	
    case comm_to:
561
	mux_printf(fp, " %lu", (unsigned long)misc.datum.comment_to);
Per Cederqvist's avatar
Per Cederqvist committed
562
563
564
	break;
	
    case comm_in:
565
	mux_printf(fp, " %lu", (unsigned long)misc.datum.commented_in);
Per Cederqvist's avatar
Per Cederqvist committed
566
567
568
	break;
	
    case footn_to:
569
	mux_printf(fp, " %lu", (unsigned long)misc.datum.footnote_to);
Per Cederqvist's avatar
Per Cederqvist committed
570
571
572
	break;
	
    case footn_in:
573
	mux_printf(fp, " %lu", (unsigned long)misc.datum.footnoted_in);
Per Cederqvist's avatar
Per Cederqvist committed
574
575
576
	break;
	
    case sent_by:
577
	mux_printf(fp, " %lu", (unsigned long)misc.datum.sender);
Per Cederqvist's avatar
Per Cederqvist committed
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
	break;
	
    case sent_at:
	prot_a_output_time(fp, misc.datum.sent_at);
	break;

#ifndef COMPILE_CHECKS
    default:
	restart_kom("prot_a_output_misc_info: Illegal misc\n");
#endif
    }
}


void
prot_a_output_time(Connection *fp,
		   time_t clock)
{
    struct tm *time;

    time = localtime( &clock );

    mux_printf(fp, " %lu %lu %lu %lu %lu %lu %lu %lu %lu",
601
602
603
604
605
606
607
608
609
	    (unsigned long) time -> tm_sec,
	    (unsigned long) time -> tm_min,
	    (unsigned long) time -> tm_hour,
	    (unsigned long) time -> tm_mday,
	    (unsigned long) time -> tm_mon,
	    (unsigned long) time -> tm_year,
	    (unsigned long) time -> tm_wday,
	    (unsigned long) time -> tm_yday,
	    (unsigned long) time -> tm_isdst);
Per Cederqvist's avatar
Per Cederqvist committed
610
611
612
613
614
615
616
}


void
prot_a_output_session_no(Connection *fp,
			 Session_no session_no)
{
617
    mux_printf(fp, " %lu", (unsigned long) session_no);
Per Cederqvist's avatar
Per Cederqvist committed
618
}
Linus Tolke's avatar
Linus Tolke committed
619
620
621
622
623

void
prot_a_output_text_no(Connection *fp,
		      Text_no text)
{
624
    mux_printf(fp, " %lu", (unsigned long) text);
Linus Tolke's avatar
Linus Tolke committed
625
}
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661

static void
prot_a_output_conf_z_info (Connection  *fp,
			   Conf_z_info *conf_c)
{
    prot_a_output_string(fp, conf_c->name);
    prot_a_output_conf_type(fp, conf_c->type);
    mux_printf (fp, " %lu", (unsigned long) conf_c -> conf_no);
}

extern void
prot_a_output_conf_z_info_list(Connection *fp,
			       Conf_z_info_list c_list)
{
    int i;

    mux_printf(fp, " %lu", (unsigned long)c_list.no_of_confs);
    if ( c_list.confs != NULL && c_list.no_of_confs > 0 )
    {
	mux_printf(fp, " {");
	for ( i = 0; i < c_list.no_of_confs; i++ )
	    prot_a_output_conf_z_info(fp, &c_list.confs[ i ]);
	mux_printf(fp, " }");
    }
    else
	mux_printf(fp, " *");
}

void
prot_a_output_version_info (Connection  *fp,
			    Version_info *v_info)
{
    mux_printf (fp, " %lu", (unsigned long) v_info->protocol_version);
    prot_a_output_string(fp, v_info->server_name);
    prot_a_output_string(fp, v_info->server_version);
}
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679

void
prot_a_output_num_list (Connection *fp,
                        Number_list *num_list)
{
    int i;
    
    mux_printf(fp, " %lu", (unsigned long) num_list->length);
    if (num_list->length == 0)
        mux_printf(fp, " *");
    else
    {
        mux_printf(fp, " {", num_list->length);
        for (i = 0; i < num_list->length; i++)
            mux_printf(fp, " %lu", num_list->data[i]);
        mux_printf(fp, " }");
    }
}