Commit 0264aa6e authored by David Byers's avatar David Byers
Browse files

Format changes to fncdef.txt. Changed semantics of session number 0....

Format changes to fncdef.txt. Changed semantics of session number 0. Auto-generation of switch in prot_a_is_legal_fnc
parent d631e6ab
......@@ -17,3 +17,4 @@ prot-a-parse-arg.h
updateLysKOM
version-info.c
version.incl
prot-a-is-legal-fnc.incl
# $Id: Makefile.am,v 1.8 1998/08/09 11:28:47 ceder Exp $
# $Id: Makefile.am,v 1.9 1999/01/14 11:39:23 byers Exp $
# Copyright (C) 1998 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -33,7 +33,8 @@ EXTRA_DIST = .cvsignore ChangeLog.1 Magics To-do \
logII.c
MOSTLYCLEANFILES = .gdbinit call-switch.incl com.h fnc-def-init.incl \
fncdef-no-str-limit.txt prot-a-parse-arg.h version.incl
fncdef-no-str-limit.txt prot-a-parse-arg.h version.incl \
prot-a-is-legal-fnc.incl
MAINTAINERCLEANFILES = aux-item-def.tab.h
......@@ -115,7 +116,7 @@ ENCRYPT = encrypt-passwd.c dbck-cache.c ram-smalloc.c ram-parse.c \
BUILT_SOURCES = prot-a-parse-arg.c version-info.c \
call-switch.incl com.h fnc-def-init.incl \
prot-a-parse-arg.h fncdef-no-str-limit.txt .gdbinit \
version.incl
version.incl prot-a-is-legal-fnc.incl
call-switch.incl: call-switch.awk fncdef-no-str-limit.txt
$(AWK) -f $(srcdir)/call-switch.awk fncdef-no-str-limit.txt \
......@@ -128,6 +129,10 @@ fnc-def-init.incl: fnc-def-init.awk fncdef-no-str-limit.txt
$(AWK) -f $(srcdir)/fnc-def-init.awk fncdef-no-str-limit.txt \
> fnc-def-init.incl
prot-a-is-legal-fnc.incl: fncdef-no-str-limit.txt prot-a-is-legal-fnc.awk
$(AWK) -f $(srcdir)/prot-a-is-legal-fnc.awk fncdef-no-str-limit.txt \
> prot-a-is-legal-fnc.incl
aux-item-def.tab.c: aux-item-def.y
$(BISON) -d -p aux_item_def_ -o aux-item-def.tab.c \
$(srcdir)/aux-item-def.y
......
/*
* $Id: admin.c,v 0.29 1998/12/26 22:40:22 byers Exp $
* $Id: admin.c,v 0.30 1999/01/14 11:39:24 byers Exp $
* Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -33,7 +33,7 @@
#endif
static const char *
rcsid = "$Id: admin.c,v 0.29 1998/12/26 22:40:22 byers Exp $";
rcsid = "$Id: admin.c,v 0.30 1999/01/14 11:39:24 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -394,3 +394,9 @@ get_collate_table (String * result)
result->len = COLLAT_TAB_SIZE;
return OK;
}
extern unsigned long
debug_info (void)
{
return 4711;
}
#
# $Id: call-switch.awk,v 0.15 1998/06/14 14:50:45 byers Exp $
# $Id: call-switch.awk,v 0.16 1999/01/14 11:39:25 byers Exp $
# Copyright (C) 1991, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,25 +22,33 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: call-switch.awk,v 0.15 1998/06/14 14:50:45 byers Exp $
# $Id: call-switch.awk,v 0.16 1999/01/14 11:39:25 byers Exp $
BEGIN {
printf("/* Don't edit this file - it is generated automatically");
printf(" from\n call-switch.awk and fncdef.txt */\n");
printf("\tswitch(client->function)\n\t{\n");
}
$1 != "#" {
printf("\tcase call_fnc_%s:\n\t ", $2);
if ( $1 == "success" )
printf("status = %s(", $2);
$1 == "#ifdef" {
printf("#ifdef %s\n", $2);
next;
}
$1 == "#endif" {
printf("#endif\n");
next;
}
$1 != "#" && $1 != "" {
printf("\tcase call_fnc_%s:\n\t ", $3);
if ( $2 == "success" )
printf("status = %s(", $3);
else
printf("res->number = %s(", $2);
printf("res->number = %s(", $3);
num=0;
string=0;
c_string=0;
for ( i = 3; i <= NF; i++)
for ( i = 4; i <= NF; i++)
{
if ( i != 3 )
if ( i != 4 )
printf(", ");
if ( $i == ":" )
{
......@@ -76,9 +84,9 @@ $1 != "#" {
}
printf(");\n");
if ( $1 == "number" )
if ( $2 == "number" )
{
if ( $2 == "get_time" )
if ( $3 == "get_time" )
printf("\t status = OK;\n");
else
printf("\t status = (res->number != 0) ? OK : FAILURE;\n");
......
#
# $Id: com-h.awk,v 0.5 1996/08/03 01:30:41 ceder Exp $
# $Id: com-h.awk,v 0.6 1999/01/14 11:39:26 byers Exp $
# Copyright (C) 1991, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,7 +22,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: com-h.awk,v 0.5 1996/08/03 01:30:41 ceder Exp $
# $Id: com-h.awk,v 0.6 1999/01/14 11:39:26 byers Exp $
BEGIN {
printf("/*\n");
printf(" * Don't edit this file! It is generated from fncdef.txt\n");
......@@ -31,11 +31,20 @@ BEGIN {
printf("enum call_header {");
cnt = 0;
}
$1 == "#" {
$1 == "#ifdef" {
printf("\n#ifdef %s", $2);
next;
}
$1 == "#endif" {
printf("\n#endif");
next;
}
$1 == "#" || $1 == "" {
next;
}
{
printf("\n call_fnc_%-20s = %d,", $2, cnt++);
cnt++
printf("\n call_fnc_%-20s = %d,", $3, $1);
}
END { printf("\n illegal_fnc = %d", cnt)
printf("\n};\n\n");
......
/*
* $Id: connections.c,v 0.51 1998/12/26 22:40:31 byers Exp $
* $Id: connections.c,v 0.52 1999/01/14 11:39:27 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -36,7 +36,7 @@
#endif
static const char *
rcsid = "$Id: connections.c,v 0.51 1998/12/26 22:40:31 byers Exp $";
rcsid = "$Id: connections.c,v 0.52 1999/01/14 11:39:27 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -120,6 +120,8 @@ const Fnc_descriptor fnc_defs[]={
#include "fnc-def-init.incl"
};
const unsigned long num_fnc_defs = sizeof (fnc_defs) / sizeof (Fnc_descriptor);
unsigned long service_statistics[sizeof (fnc_defs) / sizeof (Fnc_descriptor)];
BUGDECL;
......@@ -230,7 +232,7 @@ call_function (Connection * client,
active_connection = client;
service_statistics[client->function]++;
service_statistics[client->function_index]++;
#include "call-switch.incl"
......@@ -659,7 +661,10 @@ dump_statistics(void)
fprintf(fp, "STATISTICS:");
for ( i = 0; (size_t)i < sizeof(service_statistics) / sizeof(unsigned long); i++)
{
fprintf(fp, " %lu", service_statistics[i]);
fprintf(fp, " %d:%lu",
fnc_defs[i].function,
service_statistics[i]
);
service_statistics[i]=0;
}
......
/*
* $Id: connections.h,v 0.35 1999/01/13 12:08:25 byers Exp $
* $Id: connections.h,v 0.36 1999/01/14 11:39:28 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -23,7 +23,7 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se.
*/
/*
* $Id: connections.h,v 0.35 1999/01/13 12:08:25 byers Exp $
* $Id: connections.h,v 0.36 1999/01/14 11:39:28 byers Exp $
*
* connections.h -- The top level of the communication packet.
*
......@@ -79,7 +79,8 @@ typedef struct connection {
int string_parse_pos;
int ref_no;
Call_header function; /* Function to call. */
Call_header function; /* Function to call. */
int function_index; /* Index of function in server tables*/
/* Gather data in these variables. */
......@@ -230,12 +231,14 @@ typedef union {
typedef struct {
Res_type result;
Call_header function;
Res_type result;
/* The function that is used to parse args for this function: */
void (*parser)(Connection *client);
void (*parser)(Connection *client);
} Fnc_descriptor;
extern const Fnc_descriptor fnc_defs[];
extern const unsigned long num_fnc_defs;
/*
* This array holds number of calls to each service. It is dumped to the
......
#
# $Id: fnc-def-init.awk,v 0.6 1996/08/03 01:30:56 ceder Exp $
# $Id: fnc-def-init.awk,v 0.7 1999/01/14 11:39:29 byers Exp $
# Copyright (C) 1991, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,21 +22,32 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: fnc-def-init.awk,v 0.6 1996/08/03 01:30:56 ceder Exp $
# $Id: fnc-def-init.awk,v 0.7 1999/01/14 11:39:29 byers Exp $
BEGIN {
printf("/* Don't edit this file - it is generated automatically");
printf(" from\n fnc-def-init.awk and fncdef.txt */\n\n");
cnt=0;
}
$1 != "#" {
printf(" {");
$1 == "#ifdef" {
printf("#ifdef %s\n", $2);
next;
}
$1 == "#endif" {
printf("#endif\n");
next;
}
$1 != "#" && $1 != "" {
cnt ++;
printf(" { ");
printf("%s, ", $1);
if ( $(NF-1) == ":" )
printf("%7s,", "rt_" $NF);
printf("%7s, ", "rt_" $NF);
else
printf("%7s,", "rt_" $1);
printf("%7s, ", "rt_" $2);
printf("prot_a_parse_arg_%s},\n", $2);
printf("prot_a_parse_arg_%s },\n", $3);
}
END {
printf(" {rt_success, prot_a_hunt_nl}\n");
printf(" { %d, rt_success, prot_a_hunt_nl }\n", cnt);
}
#
# $Id: fncdef.txt,v 0.35 1999/01/13 12:08:27 byers Exp $
# $Id: fncdef.txt,v 0.36 1999/01/14 11:39:30 byers Exp $
# Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997
# Lysator Academic Computer Association.
#
......@@ -23,7 +23,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: fncdef.txt,v 0.35 1999/01/13 12:08:27 byers Exp $
# $Id: fncdef.txt,v 0.36 1999/01/14 11:39:30 byers Exp $
#
# This file is used to describe the functions in services.c. All
# functions that are reachable from the clients are listed here, together
......@@ -40,136 +40,140 @@
#
# Protocol version 1
#
success login_old num c_string (param.pwd_len)
success logout
success change_conference num
success change_name num c_string (param.conf_name_len)
success change_what_i_am_doing string (param.what_do_len)
number create_person_old c_string (param.conf_name_len) c_string (param.pwd_len)
success get_person_stat_old num num : person
success set_priv_bits num priv_bits
success set_passwd num c_string (param.pwd_len) c_string (param.pwd_len)
success query_read_texts_old num num : membership_old
number create_conf_old c_string (param.conf_name_len) conf_type
success delete_conf num
success lookup_name c_string (param.conf_name_len) : conf_list
success get_conf_stat_older num num : conference_old
success add_member_old num num num num
success sub_member num num
success set_presentation num num
success set_etc_motd num num
success set_supervisor num num
success set_permitted_submitters num num
success set_super_conf num num
success set_conf_type num conf_type
success set_garb_nice num num
success get_marks : mark_list
success mark_text_old num num
success get_text num num num : string
success get_text_stat_old num : text_stat_old
success mark_as_read num num c_local_text_no_p (param.mark_as_read_chunk)
number create_text_old c_string (param.text_len) num c_misc_info_p (param.max_crea_misc)
success delete_text num
success add_recipient num num num
success sub_recipient num num
success add_comment num num
success sub_comment num num
success get_map num num num : l2g_iterator_as_text_list
success get_time : time_date
success get_info_old : info_old
success add_footnote num num
success sub_footnote num num
success who_is_on_old : who_info_list_old
success set_unread num num
success set_motd_of_lyskom num
success enable num
success sync_kom
success shutdown_kom num
success broadcast c_string (param.broadcast_len)
success get_membership_old num num num num : membership_list_old
success get_created_texts num num num : l2g_iterator_as_text_list
success get_members_old num num num : member_list_old
success get_person_stat num : person
success get_conf_stat_old num : conference_old
success who_is_on : who_info_list
success get_unread_confs num : conf_no_list
success send_message num c_string (param.broadcast_len)
success get_session_info num : session_info
success disconnect num
success who_am_i : session_no
0 success login_old num c_string (param.pwd_len)
1 success logout
2 success change_conference num
3 success change_name num c_string (param.conf_name_len)
4 success change_what_i_am_doing string (param.what_do_len)
5 number create_person_old c_string (param.conf_name_len) c_string (param.pwd_len)
6 success get_person_stat_old num num : person
7 success set_priv_bits num priv_bits
8 success set_passwd num c_string (param.pwd_len) c_string (param.pwd_len)
9 success query_read_texts_old num num : membership_old
10 number create_conf_old c_string (param.conf_name_len) conf_type
11 success delete_conf num
12 success lookup_name c_string (param.conf_name_len) : conf_list
13 success get_conf_stat_older num num : conference_old
14 success add_member_old num num num num
15 success sub_member num num
16 success set_presentation num num
17 success set_etc_motd num num
18 success set_supervisor num num
19 success set_permitted_submitters num num
20 success set_super_conf num num
21 success set_conf_type num conf_type
22 success set_garb_nice num num
23 success get_marks : mark_list
24 success mark_text_old num num
25 success get_text num num num : string
26 success get_text_stat_old num : text_stat_old
27 success mark_as_read num num c_local_text_no_p (param.mark_as_read_chunk)
28 number create_text_old c_string (param.text_len) num c_misc_info_p (param.max_crea_misc)
29 success delete_text num
30 success add_recipient num num num
31 success sub_recipient num num
32 success add_comment num num
33 success sub_comment num num
34 success get_map num num num : l2g_iterator_as_text_list
35 success get_time : time_date
36 success get_info_old : info_old
37 success add_footnote num num
38 success sub_footnote num num
39 success who_is_on_old : who_info_list_old
40 success set_unread num num
41 success set_motd_of_lyskom num
42 success enable num
43 success sync_kom
44 success shutdown_kom num
45 success broadcast c_string (param.broadcast_len)
46 success get_membership_old num num num num : membership_list_old
47 success get_created_texts num num num : l2g_iterator_as_text_list
48 success get_members_old num num num : member_list_old
49 success get_person_stat num : person
50 success get_conf_stat_old num : conference_old
51 success who_is_on : who_info_list
52 success get_unread_confs num : conf_no_list
53 success send_message num c_string (param.broadcast_len)
54 success get_session_info num : session_info
55 success disconnect num
56 success who_am_i : session_no
#
# Protocol version 2
#
success set_user_area num num
57 success set_user_area num num
#
# Protocol version 3
#
success get_last_text time_date : text_no
number create_anonymous_text_old c_string (param.text_len) num c_misc_info_p (param.max_crea_misc)
success find_next_text_no num : text_no
success find_previous_text_no num : text_no
58 success get_last_text time_date : text_no
59 number create_anonymous_text_old c_string (param.text_len) num c_misc_info_p (param.max_crea_misc)
60 success find_next_text_no num : text_no
61 success find_previous_text_no num : text_no
#
# Protocol version 4
#
success login num c_string (param.pwd_len) num
success who_is_on_ident : who_info_ident_list
success get_session_info_ident num : session_info_ident
62 success login num c_string (param.pwd_len) num
63 success who_is_on_ident : who_info_ident_list
64 success get_session_info_ident num : session_info_ident
#
# Protocol version 5
#
success re_lookup_person c_string (param.regexp_len) : conf_no_list
success re_lookup_conf c_string (param.regexp_len) : conf_no_list
65 success re_lookup_person c_string (param.regexp_len) : conf_no_list
66 success re_lookup_conf c_string (param.regexp_len) : conf_no_list
#
# Protocol version 6
#
success lookup_person c_string (param.conf_name_len) : conf_no_list
success lookup_conf c_string (param.conf_name_len) : conf_no_list
success set_client_version c_string (param.conf_name_len) c_string (param.conf_name_len)
success get_client_name num : string
success get_client_version num : string
success mark_text num num
success unmark_text num
67 success lookup_person c_string (param.conf_name_len) : conf_no_list
68 success lookup_conf c_string (param.conf_name_len) : conf_no_list
69 success set_client_version c_string (param.conf_name_len) c_string (param.conf_name_len)
70 success get_client_name num : string
71 success get_client_version num : string
72 success mark_text num num
73 success unmark_text num
#
# Protocol version 7
#
success re_z_lookup c_string (param.regexp_len) num num : conf_z_info_list
success get_version_info : version_info
success lookup_z_name c_string (param.conf_name_len) num num : conf_z_info_list
74 success re_z_lookup c_string (param.regexp_len) num num : conf_z_info_list
75 success get_version_info : version_info
76 success lookup_z_name c_string (param.conf_name_len) num num : conf_z_info_list
#
# Protocol version 8
#
success set_last_read num num
success get_uconf_stat num : uconference
77 success set_last_read num num
78 success get_uconf_stat num : uconference
#
# Protocol version 9
#
success set_info info
success accept_async num_list (param.accept_async_len)
success query_async : num_list
success user_active
success who_is_on_dynamic num num num : dynamic_session_info_list
success get_static_session_info num : static_session_info
79 success set_info info
80 success accept_async num_list (param.accept_async_len)
81 success query_async : num_list
82 success user_active
83 success who_is_on_dynamic num num num : dynamic_session_info_list
84 success get_static_session_info num : static_session_info
#
# Protocol version 10
#
success get_collate_table : string
number create_text c_string (param.text_len) num c_misc_info_p (param.max_crea_misc) aux_item_list (param.max_add_aux)
number create_anonymous_text c_string (param.text_len) num c_misc_info_p (param.max_crea_misc) aux_item_list (param.max_add_aux)
number create_conf c_string (param.conf_name_len) conf_type aux_item_list (param.max_add_aux)
number create_person c_string (param.conf_name_len) c_string (param.pwd_len) aux_item_list (param.max_add_aux)
success get_text_stat num : text_stat
success get_conf_stat num : conference
success modify_text_info num num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
success modify_conf_info num num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
success get_info : info
success modify_server_info num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
success query_predefined_aux_items : num_list
success set_expire num num
success query_read_texts num num : membership
success get_membership num num num num : membership_list
success add_member num num num num membership_type
success get_members num num num : member_list
success set_membership_type num num membership_type
success local_to_global num num num : text_mapping
success map_created_texts num num num : text_mapping
success set_keep_commented num num
85 success get_collate_table : string
86 number create_text c_string (param.text_len) num c_misc_info_p (param.max_crea_misc) aux_item_list (param.max_add_aux)
87 number create_anonymous_text c_string (param.text_len) num c_misc_info_p (param.max_crea_misc) aux_item_list (param.max_add_aux)
88 number create_conf c_string (param.conf_name_len) conf_type aux_item_list (param.max_add_aux)
89 number create_person c_string (param.conf_name_len) c_string (param.pwd_len) aux_item_list (param.max_add_aux)
90 success get_text_stat num : text_stat
91 success get_conf_stat num : conference
92 success modify_text_info num num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
93 success modify_conf_info num num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
94 success get_info : info
95 success modify_server_info num_list (param.max_delete_aux) aux_item_list (param.max_add_aux)
96 success query_predefined_aux_items : num_list
97 success set_expire num num
98 success query_read_texts num num : membership
99 success get_membership num num num num : membership_list
100 success add_member num num num num membership_type
101 success get_members num num num : member_list
102 success set_membership_type num num membership_type
103 success local_to_global num num num : text_mapping
104 success map_created_texts num num num : text_mapping
105 success set_keep_commented num num
#ifdef DEBUG_CALLS
999 number debug_info
#endif
/*
* $Id: internal-connections.c,v 0.32 1998/12/26 22:40:37 byers Exp $
* $Id: internal-connections.c,v 0.33 1999/01/14 11:39:30 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -35,7 +35,7 @@
static const char *
rcsid = "$Id: internal-connections.c,v 0.32 1998/12/26 22:40:37 byers Exp $";
rcsid = "$Id: internal-connections.c,v 0.33 1999/01/14 11:39:30 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -331,6 +331,9 @@ get_conn_by_number (Session_no session_no)
end = last_conn;
if (session_no == 0)
session_no = active_connection->session_no;
do
{
if ( last_conn->session_no == session_no )
......@@ -352,7 +355,10 @@ traverse_connections (Session_no session_no)
if ( all_connections == NULL )
return 0;
prev = get_conn_by_number ( session_no );
if (session_no == 0)
prev = NULL;
else
prev = get_conn_by_number ( session_no );
/* prev is NULL if session_no is 0, or if session_no was logged out. */
......
# $Id: prot-a-is-legal-fnc.awk,v 1.1 1999/01/14 11:39:31 byers Exp $
# Copyright (C) 1991, 1993, 1994, 1995, 1996 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.
#
# $Id: prot-a-is-legal-fnc.awk,v 1.1 1999/01/14 11:39:31 byers Exp $
BEGIN {
printf("/* Don't edit this file - it is generated automatically");
printf(" from\n prot-a-is-legal-fnc.awk and fncdef.txt */\n");
printf("\n");
printf("\tswitch(fnc) {\n");
cnt = 0;
}
$1 == "#ifdef" {
printf("#ifdef %s\n", $2);
next;
}
$1 == "#endif" {
printf("#endif\n");
next;
}