Protocol-A.texi 258 KB
Newer Older
David Byers's avatar
David Byers committed
1
\input texinfo                         @c -*-texinfo-*-
David Byers's avatar
David Byers committed
2
@c $Id: Protocol-A.texi,v 1.47 1998/12/30 17:39:30 byers Exp $
David Byers's avatar
David Byers committed
3 4 5 6 7 8 9
@c %**start of header
@setfilename protocol-a.info
@settitle LysKOM Protocol A
@setchapternewpage odd
@c %**end of header
@iftex
@parindent 0pt
10
@font@tensltt=cmsltt10
11 12 13 14 15
@begin tex
\global\def\rett#1{{\let\t\sltt\tt #1}}
\global\def\sltt#1{{\fam\ttfam\tensltt\let\t\rett #1}}
\global\let\t\sltt
@end tex
David Byers's avatar
David Byers committed
16 17 18
@end iftex

@ifinfo
19
This is the specification of LysKOM Protocol A v. 9.0
David Byers's avatar
David Byers committed
20

David Byers's avatar
David Byers committed
21
Copyright @copyright{} 1995-1999 Lysator ACS.
David Byers's avatar
David Byers committed
22 23 24 25 26 27

Permission is granted to make and distribute verbatim copies of this
specification provided the copyright notice and this permission notice
are preserved on all copies.
@end ifinfo

28 29 30 31 32
@dircategory LysKOM
@direntry
* Protocol A: (protocol-a).             The LysKOM Protocol A specification.
@end direntry

David Byers's avatar
David Byers committed
33 34 35 36
@titlepage
@sp 10
@title{LysKOM Protocol A}
@sp 2
37
@subtitle{Protocol version 10.0}
David Byers's avatar
David Byers committed
38 39 40 41 42
@sp 2
@author by the LysKOM Developers

@page
@vskip 0pt plus 1filll
David Byers's avatar
David Byers committed
43
Copyright @copyright{} 1995-1999 Lysator ACS
David Byers's avatar
David Byers committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

Permission is granted to make and distribute verbatim copies of this document
provided the copyright notice and this permission notice are preserved on all
copies.

Modified versions of this document may be redistributed with the added
condition that all modifications not cleared with the LysKOM development group
are clearly marked and that the entire modified work be redistributed under the
same conditions as the original.

Permission is granted to copy and distribute translations of this manual into
another language under the same conditions as for modified versions.

@end titlepage

@ifinfo
@node Top, Overview, (dir), (dir)
@comment node-name, next, previous, up
Per Cederqvist's avatar
Per Cederqvist committed
62
This document specifies LysKOM Protocol A, version 9.0.
David Byers's avatar
David Byers committed
63

64 65 66 67
FIXME: This document is not yet published.  The document you are looking
at has the version numbers all wrong.  This will be fixed before
publication.

David Byers's avatar
David Byers committed
68 69 70 71 72 73
@menu
* Overview::
* Introduction::
* Data Types::
* Protocol Requests::
* Asynchronous Messages::
74 75 76 77
* Error Codes::
* LysKOM Content Types::
* The User Area::
* Writing Clients::
78 79
* Type Index::
* Request Index::
David Byers's avatar
David Byers committed
80 81 82 83 84 85 86
@end menu
@end ifinfo

@node Overview, Document Revision History, Top, Top
@chapter Overview

LysKOM is a conferencing system@footnote{Or in modern terms, enabling
87 88 89 90 91 92
technology for Computer-Supported Cooperative Work (CSCW).}. Similar
systems were QZ-KOM and PortaCOM@footnote{Also known as ``PottaKOM'' and
``BortaKOM.''}. The LysKOM system is copyrighted by Lysator Academic
Computing Society and distributed under conditions of the GNU Public
License. LysKOM and its documentation is provided ``as is'' without
warranty of any kind.
David Byers's avatar
David Byers committed
93

94 95 96
This document specifies version 10.0 of protocol A used between a LysKOM
client and a LysKOM server. Anything described here as ``unspecified''
is liable to change in future protocol versions.
David Byers's avatar
David Byers committed
97 98

This specification is the work of several people. The main contributors have
99 100 101
been
Per Cederqvist @code{<ceder@@lysator.liu.se>}, 
David Byers @code{<byers@@lysator.liu.se>},
David Byers's avatar
David Byers committed
102 103 104 105 106 107
@ifinfo
Pär
@end ifinfo
@iftex
P@"ar
@end iftex
108 109 110
Emanuelsson @code{<pell@@lysator.liu.se>},
Thomas Bellman @code{<bellman@@lysator.liu.se>}, 
Lars Aronsson @code{<aronsson@@lysator.liu.se>},
David Byers's avatar
David Byers committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
Linus Tolke @code{<linus@@lysator.liu.se>} and
@ifinfo
Kent Engström
@end ifinfo
@iftex
Kent Eng@-str@"om@penalty-10000
@end iftex
@code{<kent@@lysator.liu.se>}.

The LysKOM developers can be reached by email to @code{lyskom@@lysator.liu.se}.

@menu 
* Document Revision History::
* Protocol Revision History::
* Protocol Design Principles::
* Notation::
@end menu

@node Document Revision History, Protocol Revision History, Overview, Overview
@section Document Revision History

@table @asis
133

134 135 136 137
@item 9.0: @i{In progress}
Protocol version 9 is begin developed and this document needs to be
updated.

David Byers's avatar
David Byers committed
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 165 166 167
@item 8.0: 1995-11-10
Protocol version 8 is being documented. This specification was translated to
English and converted to Texinfo by David Byers.

@item 7.1: 1995-01-08.
Protocol and document revision history were added by Per Cederqvist. Outline
mode was used to make the document more manageable. This version was
distributed with lyskomd 1.7.1.

@item 7.0: 1994-12-31.
The first specification with a version number. All calls that had been added
since 1991-06-25 were documented. Pell and Per Cederqvist did the deed. This
version was distributed with lyskomd 1.7.0.

@item 1993-05-19.
Linus Tolke wrote comments for some calls that were without comments.

@item 1992-07-06.
Linus Tolke converted the document to ISO 8859-1.

@item 1991-08-12.
Per Cederqvist started using version control for documentation.

@item 1991-06-25.
Lars Aronsson documented the protocol that was in use at the time.
@end table

@node Protocol Revision History, Protocol Design Principles, Document Revision History, Overview
@section Protocol Revision History

168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
@subsection Protocol version 10.0
@table @asis
@item New Server Calls
@itemize @bullet
@item 85=get-collate-table
@item 86=create-text
@item 87=create-anonymous-text
@item 88=create-conf
@item 89=create-person
@item 90=get-text-stat
@item 91=get-conf-stat
@item 92=modify-text-info
@item 93=modify-conf-info
@item 94=get-info
@item 95=modify-system-info
@item 96=query-predefined-aux-items
@item 97=set-expire
185 186 187 188
@item 98=query-read-texts
@item 99=get-membership
@item 100=add-member
@item 101=get-members
189 190
@item 102=local-to-global
@item 103=map-created-texts
191 192 193 194 195
@end itemize

@item Removed Server Calls
@itemize @bullet
@item  5=create-person
196
@item  9=query-read-texts
197
@item 10=create-conf
198
@item 14=add-member
199 200 201
@item 26=get-text-stat
@item 28=create-text
@item 36=get-info-old
202 203
@item 46=get-membership-old
@item 48=get-members-old
204 205 206 207 208 209
@item 50=get-conf-stat
@item 59=create-anonymous-text
@end itemize

@item New and New Modified Structures
@itemize @bullet
210
@item Aux-Item
211
@item Aux-Item-Input
212 213
@item Conference
@item Info
214 215 216
@item Member
@item Membership
@item Membership-Type
217 218
@item Misc-Info
@item Text-Stat
219 220 221 222 223 224 225
@end itemize

@item New Asynchronous Messages
@itemize @bullet
@item async-deleted-text message
@item New async-new-text message
@end itemize
226 227 228 229 230 231 232 233 234 235 236 237 238

@item Notes
@itemize @bullet
@item Since protocol version 9 setting a priority of zero in a
conference was supposed to indicate passive membership in a conference. 
It was largely up to the client to implement this. True passive
memberships have been introduced in this protocol version through the
Membership-type extension to Membership type. In order to maintain
compatibility with clients that interpret priority 0 as passive
membership, the old calls @pxref{add-member-old} and
@pxref{get-membership-old} perform magic, translating between priorities 
and membership types. The magic is documented with each call.
@end itemize
239 240
@end table

241

242 243 244
@subsection Protocol version 9.0

@table @asis
Per Cederqvist's avatar
Per Cederqvist committed
245
@item Added Commands
246
@itemize @bullet
247 248 249 250 251 252
@item 79=set-info: Can change server information.
@item 80=accept-async: Can select asynchronous messages to receive.
@item 81=query-async: Can query which messages are being send.
@item 82=user-active
@item 83=who-is-on-dynamic
@item 84=get-static-session-info
253 254 255
@end itemize
@end table

David Byers's avatar
David Byers committed
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
@subsection Protocol version 8.0

@table @asis 
@item Added Functionality
@itemize @bullet
@item
30=add-recipient: Can change recpt to cc_recpt and vice versa.
@item
21=set-conf-type: Accepts Conf-Type and Extended-Conf-Type.
@item
10=create-conf: Accepts Conf-Type and Extended-Conf-Type.
@end itemize

@item New Commands
@itemize @bullet
@item
77=set-last-read
@item
78=get-uconf-stat
@end itemize
@end table

@subsection Protocol version 7 (first implemented in lyskomd 1.7.0)

@table @asis
@item Added Functionality
@itemize @bullet
@item
53=send-message: Recipient can be a conference or a person.
@end itemize

@item New Commands
@itemize @bullet
@item
74=re-z-lookup
@item
75=get_version_info
@item
76=lookup_z_name
@end itemize

@item Other
@itemize @bullet
@item
Per Cederqvist's avatar
Per Cederqvist committed
300
The asynchronous message 1=i-am-off has been removed
David Byers's avatar
David Byers committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
@end itemize
@end table

@subsection Protocol Version 6 (first implemented in lyskomd 1.4.0)

@table @asis
@item New Calls
@itemize @bullet
@item
67=lookup_person
@item
68=lookup_conf
@item
69=set_client_version
@item
70=get_client_name
@item
71=get_client_version
@item
72=mark_text
@item
73=unmark_text
@end itemize
@end table


@subsection Protocol Version 5 (first implemented in lyskomd 1.3.0)

@table @asis
@item New Calls
@itemize @bullet
@item
65=re_lookup_person
@item
66=re_lookup_conf
@end itemize
@end table

@subsection Protocol Version 4 (first implemented in lyskomd 1.1.1)

@table @asis
@item New Calls
@itemize @bullet
@item
62=login
@item
63=who_is_on_ident
@item
64=get_session_info_ident
@end itemize
@end table

@subsection Protocol Version 3 (first implemented in lyskomd 1.1.0)

@table @asis
@item New Calls
@itemize @bullet
@item
61=find_previous_text_no
@item
60=find_next_text_no
@item
59=create_anonymous_text
@item
58=get_last_text
@end itemize
@end table

@subsection Protocol Version 2 (first implemented in lyskomd 0.30.0)

@table @asis
@item New Calls
@itemize @bullet
@item
57=set_user_area
@end itemize
@end table

@subsection Protocol Version 1 (first implemented in lyskomd 0.29.2)

@table @asis
@item New Calls
All calls from 0--56.
@end table


@node Protocol Design Principles, Notation, Protocol Revision History, Overview
@section Transport Protocol Requirements

LysKOM protocol A can be run on top of any reliable, bidirectional,
8-bit data stream. All current implementations use TCP/IP. At Lysator
port 4894 is used on the host @code{kom.lysator.liu.se}.

394
Data in protocol A is ASCII clear text except within Hollerith strings,
395 396 397 398
where arbitrary eight-bit characters are allowed. Data arguments are
separated by whitespace. The reason for this unorthodox design is that
the protocol should be usable from a text-only terminal, something that
is very useful during server and early client development.
David Byers's avatar
David Byers committed
399 400 401 402 403


@node Notation, , Protocol Design Principles, Overview
@section Notation

404 405 406
This specification uses a BNF-like grammar to describe the protocol and
its data elements. It does not use ASN.1 because we don't know ASN.1 and
probably wouldn't like it very much even if we did.
David Byers's avatar
David Byers committed
407

408
Data fields have been given names that start with a lower-case letter.
409 410 411 412 413 414 415 416 417 418 419

Fundamental data types have names in all-caps (such as @code{INT32} and
@code{ARRAY}).

Derived data types have names that start with an upper-case letter. (If
the type contains more than one word, all words start with an upper-case
letter, like this: @code{Text-Stat}.)  The operator @code{::=} defines
the name to its left.

Comments start with @code{!} (exclamation mark) and alternatives are
separated by a @code{|} (vertical bar.) A @code{;} (semicolon)
420 421 422
terminates statements in the grammar. In some specifications there are
literal strings. There is to be no whitespace before or after literal
strings unless there is whitespace in the literal itself.
David Byers's avatar
David Byers committed
423 424 425 426 427 428 429 430 431 432 433 434 435


@node Introduction, , , Top
@chapter Introduction

This chapter introduces the concepts used in LysKOM, such as articles,
conferences and sessions. 

@menu
* Articles ::
* Conferences ::
* Persons and Sessions ::
* The Misc-Info List ::
436
* The Aux-Item List ::
David Byers's avatar
David Byers committed
437 438 439 440 441 442 443 444 445 446 447
* Security ::
* Membership and Reading::
* Client-Server Dialog ::
@end menu


@node Articles, Conferences, , Introduction
@section Articles

An article is represented as a value of the type @code{Text-Stat} and a
string containing the article contents. An article will usually have one
448 449 450 451
or more recipients and may be a comment or footnote to other articles.
Each article is kept in the database until it is older than the
@code{nice} value of each of its recipients and it is not marked by any
user.
David Byers's avatar
David Byers committed
452

453 454 455 456 457
Currently there is a structure called a @code{Misc-Info-List} associated
with the @code{Text-Stat}. This list contains information about
recipients, senders, comments and footnotes. In the future the
information contained in the @code{Misc-Info-List} will be integrated
into the @code{Text-Stat}.
David Byers's avatar
David Byers committed
458 459 460

Every article has at least one number, the global article number. Global
numbers are assigned in ascending order to new articles, and are never
461
reused. If an article has recipients it will also have a local number
Per Cederqvist's avatar
Per Cederqvist committed
462
for each recipient. Local numbers are used in some data structures to
463
provide more compact storage and to provide an ordering of articles for
464 465 466
a particular recipient. Local numbers are assigned in ascending order
and are never reused for a particular recipient, though different
recipients will have articles with the same local numbers.
David Byers's avatar
David Byers committed
467

468
Occasionally it is necessary to map between local and global numbers.
469
The server call @code{local-to-global} does this.
David Byers's avatar
David Byers committed
470 471 472 473 474 475



@node Conferences, Persons and Sessions, Articles, Introduction
@section Conferences

476 477 478 479
Conferences hold articles. They are represented in the protocol as a
data type called @code{Conference}. Each conference has a
@emph{creator}, the person who created the conference, and a
@emph{supervisor}, a conference whose members can modify the conference.
David Byers's avatar
David Byers committed
480
If the supervisor is a person, the members of that person's mailbox
481 482 483 484 485
are supervisors, which in most cases is only that person. We have also
introduced a type called @code{UConference} (pronounced micro-conf-stat)
which holds a subset of the information contained in the full
@code{Conference} type. Use the @code{UConference} type whenever
possible since it places a much smaller load on the LysKOM server.
David Byers's avatar
David Byers committed
486 487

Each conference has a type, which is essentially a collection of boolean
Per Cederqvist's avatar
Per Cederqvist committed
488
flags. Currently the flags @code{rd-prot}, @code{letterbox},
489
@code{secret}, @code{original} and @code{allow-anonymous} are defined.
David Byers's avatar
David Byers committed
490 491 492 493 494 495 496

@table @code
@item rd-prot
The conference is protected from reading by non-members. Persons become
members by having one of the existing members or supervisors add him or
her to the conference. This restriction is enforced by the server.
@item original
497 498 499 500
Conferences of this type are intended for original articles only.
Comments are to be redirected to the super-conference instead. This
restriction is currently not enforced by the server; clients must
implement this functionality.
David Byers's avatar
David Byers committed
501
@item letterbox
502
Conferences of this type are connected to persons. Letters to a person
David Byers's avatar
David Byers committed
503
are sent to the mailbox and the name of the mailbox is synchronized
504 505
with the person name. It is currently not possible to explicitly set or
clear this flag on a conference.
David Byers's avatar
David Byers committed
506 507 508
@item secret
Conferences of this type are secret. The server will not divulge any
information of the existence of the conference to persons who are not
David Byers's avatar
David Byers committed
509
members or supervisors of the conference. If a mailbox is made secret,
David Byers's avatar
David Byers committed
510 511
that person cannot log in using the person name, but must specify a
person number instead.
512 513 514
@item allow-anonymous
Conferences of this type accept anonymous articles. Other conferences
will reject anonymous articles.
David Byers's avatar
David Byers committed
515 516 517
@item forbid-secret
Conferences of this type do not allow secret members. If a conference is 
changed to this type, preexisting secret members remain secret.
David Byers's avatar
David Byers committed
518 519 520 521 522 523 524 525
@end table



@node Persons and Sessions, The Misc-Info List, Conferences, Introduction
@subsection Persons and Sessions

Persons are represented in the protocol by values of the type
526 527 528 529
@code{Person}. Associated with persons are statistics, a set of personal
flags and a set of privileges (@pxref{Security}.) Persons are also
associated with a conference that has the same number as the person and
the @code{letterbox} bit set.
David Byers's avatar
David Byers committed
530 531

Connections to the server are represented as values of the type
532 533 534 535 536 537
@code{Static-Session-Info}, @code{Session-Info-Ident} or
@code{Session-Info}. Sessions have session number that are unique for
each session in the lifetime of the server execution. A single user can
have several sessions running at once. The session is not released until
the network connection is closed; a user can log in and out repeatedly
in a single session.
David Byers's avatar
David Byers committed
538 539


540
@node The Misc-Info List, The Aux-Item List, Persons and Sessions, Introduction
David Byers's avatar
David Byers committed
541 542
@section The Misc-Info List

543 544
The @code{Misc-Info} list contains tagged data. The fields are sent in
groups pertaining to a particular type of information: information about
545 546
recipient; carbon copy recipient; blank carbon copy recipient;
comment to; footnote to; comment in
547 548 549
and footnote in. The information groups may be sent in any order and
there may be any number of groups. Within each group the elements are
always sent in the order listed below.
David Byers's avatar
David Byers committed
550

551
@subsection Recipient
David Byers's avatar
David Byers committed
552 553 554

@table @code
@item recpt
555 556
Starts a recipient group. It contains the conference number of a
recipient of the article.
David Byers's avatar
David Byers committed
557
@item loc-no
558 559 560
Always present within a recipient group. It contains the local text
number of the article in the conference specified by the preceding
@code{recpt} field.
David Byers's avatar
David Byers committed
561
@item rec-time
562 563 564
If the recipient is a person, this element is added by the server when
the recipient marks the article as read. It contains the time when the
text was read.
David Byers's avatar
David Byers committed
565
@item sent-by
566 567 568
Present when the recipient was added by a person other than the author
(after the article was created.) It contains the person number of the
person who added the recipient.
David Byers's avatar
David Byers committed
569
@item sent-at
570 571
Present when the recipient was added after the article was created. It
contains the time when the recipient was added.
David Byers's avatar
David Byers committed
572 573 574
@end table


575
@subsection Carbon Copy (CC) Recipient
David Byers's avatar
David Byers committed
576

577 578 579 580
The carbon-copy recipient group is identical to the recipient group
above. The difference is how new comments to an article with a recipient
or carbon-copy recipient are treated. A comment to an article is sent to
all recipients, but not to carbon-copy recipients of the original
Per Cederqvist's avatar
Per Cederqvist committed
581
article. This difference is enforced by the clients.
David Byers's avatar
David Byers committed
582 583 584

@table @code
@item cc-recpt
585 586
Starts a carbon-copy recipient group. It contains the conference number
of a carbon-copy recipient of the article.
David Byers's avatar
David Byers committed
587
@item loc-no
588 589 590
Always present in a CC recipient group. It contains the local text
number of the article in the conference specified by the most recent
@code{cc-recpt} field.
David Byers's avatar
David Byers committed
591
@item rec-time
592
Present after the CC recipient has read the article. It contains the
593 594
time when the article was read. Since only persons can read articles
this will only be seen if the CC recipient is a person.
David Byers's avatar
David Byers committed
595 596 597
@item sent-by
Present when a CC recipient was added by a person other than the author
after the article had been created. It contains the person number of the
598
person who added the CC recipient.
David Byers's avatar
David Byers committed
599 600 601 602 603 604
@item sent-at
Present when a CC recipient was added after the article had been
created. It is the time when the CC recipient was added.
@end table


605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
@subsection Blank Carbon Copy (BCC) Recipient

The blank carbon-copy recipient group is identical to the carbon-copy
recipient group above. The difference is the visibility of the
information. A carbon-copy recipient group is visible to anyone that is
allowed to fetch both the text status of the involed text and the
conference status of the involved conference.  (That is, as long as the
conference isn't secret everybody is allowed to se the carbon-copy
recipient group.)

A BCC recipient group is only visible to members and supervisors of the
recipient.  This is enforced by the server.

This type of group was introduced in protocol version 10.  When
old-style calls such as @code{@xref{get-text-stat-old}} are used this
will be converted to a CC recipient group by the server for the benefit
of clients that don't understand this group.

@table @code
@item bcc-recpt
Starts a blank carbon-copy recipient group. It contains the conference
number of a blank carbon-copy recipient of the article.
@item loc-no
Always present in a BCC recipient group. It contains the local text
number of the article in the conference specified by the most recent
@code{bcc-recpt} field.
@item rec-time
Present after the BCC recipient has read the article. It contains the
time when the article was read. Since only persons can read articles
this will only be seen if the BCC recipient is a person.
@item sent-by
Present when a BCC recipient was added by a person other than the author
after the article had been created. It contains the person number of the
person who added the BCC recipient.
@item sent-at
Present when a BCC recipient was added after the article had been
created. It is the time when the BCC recipient was added.
@end table


645
@subsection Comment To
David Byers's avatar
David Byers committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659

@table @code
@item comm-to
Always present when the article is a comment to another article.
@item sent-by
Present when the article was added as a comment by a person other than
the author, after the article had been created. It contains the person
number of the person who added the article as a comment.
@item sent-at
Present when the article was added as a comment after the article had
been created. It contains the time when is was added as a comment.
@end table


660
@subsection Footnote To
David Byers's avatar
David Byers committed
661 662

@table @code
663
@item footn-to
David Byers's avatar
David Byers committed
664 665 666 667 668 669 670
Always present when the article is a footnote to another article.
@item sent-at
Present when the article was added as a footnote after the article had
been created. It contains the time when is was added as a footnote.
@end table


671
@subsection Comment in
David Byers's avatar
David Byers committed
672 673 674 675 676 677 678 679

@table @code
@item comm-in
Present when there are comments to this article. It contains the article
number which is a comment to this article.
@end table


680
@subsection Footnote in
David Byers's avatar
David Byers committed
681 682

@table @code
683
@item footn-in
David Byers's avatar
David Byers committed
684 685 686 687 688
Present when there are footnotes to this article. It contains the
article number which is a footnote to this article.
@end table


689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
@node The Aux-Item List, Security, The Misc-Info List, Introduction
@subsection The Aux-Item List

The aux-item list is used as a generic extension mechanism in the LysKOM
server and in protocol A. 

@menu
* About Aux-Items ::
* Predefined Aux-Item Types ::
* Client-Specific Aux-Item Types ::
* Experimental Aux-Item Types ::
* Defining New Aux-Item Types ::
@end menu

@node About Aux-Items, Predefined Aux-Item Types, , The Aux-Item List
@subsubsection About Aux-Items

Aux-items were introduced in protocol version 10 as a mechanism for
extending the conference, text and server information structures without
changing the protocol. Persons were excluded since nobody could figure
David Byers's avatar
David Byers committed
709
out a case where setting an aux-item on the mailbox wasn't as good as
710 711 712 713 714 715 716 717 718
setting it on the person (another reason was that I was fed up writing
aux-item code by the time they were working on texts and conferences.)

The exact structure of an aux item is specified elsewhere (@pxref{LysKOM
Data Types}). The important fields here are the aux-no, tag and data
fields.

The aux-no field is used to identify an item. The aux-no together with a
text or conference number uniquely identifies a particular aux item.
719
Items are numbered from one and up within each item list. Once assigned,
720 721 722 723
the aux-no for an item is never changed. New items are guaranteed to
be assigned numbers that have never been used before within a particular
list.

724
The tag field identifies the type of aux item. It is used by the server
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
and by clients to figure out how to interpret the data field, and by the
server to decide if the item needs special treatment.

The data field is a simple string. The meaning of the string is
determined by the tag field, but since it is a string, clients that have
no understanding of the contents can successfully parse the item anyway
(in contrast to items in the misc-info list.)



@node Predefined Aux-Item Types, Client-Specific Aux-Item Types, About Aux-Items, The Aux-Item List
@subsubsection Predefined Aux-Item Types

Predefined Aux-Item types are part of Protocol A, and clients are
encouraged to support all of them. As with other parts of the protocol,
changes to these item types will probably always be
backwards-compatible.

Predefined types can case serious magic to be invoked in the server.
There is no limit to the strangeness that may be associated with this
type of item. The server may also place limits on who may create
predefined items, might verify the data field, and can force any field
in the item to a specific value, no matter what the client specified.

749
All items with tags in the range 1-9999 and 30000 and up are considered
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
predefined. If a client attempts to create an item with a tag in this
range, but the server has no idea what that tag means, the server will
return an error (KOM_ILL_AUX.)



@table @samp
@item content-type [1] (text)
Specifies the content type of a text. Data is a valid MIME type of one
of the special LysKOM types (@pxref{LysKOM Content Types}.)

This item may only be set by the author of a text. The inherit, secret
and hide-owner bits are cleared. Only one content-type item can be
created per creator.


@item fast-reply [2] (text)
Data is a string that constitutes a brief comment to the text. This
comment should be displayed immediately after the text body. 

David Byers's avatar
David Byers committed
770 771
An item of this type will never be inherited, can always be deleted, is
never anonymous and is never secret.
772 773 774


@item cross-reference [3] (text, conference)
David Byers's avatar
David Byers committed
775 776 777 778 779 780 781 782
Data is a cross-reference to something else. The contents consist of a
letter, a number, a space and a descriptive text. The letter must be one
of T, C or P. T specifies that the cross-reference points to a text; C
that it points to a conference; and P that it points to a person. The
number is the id of the target of the cross reference. The descriptive
text is simly that, a text that describes the cross-reference. For
example, "T15 Check this out!" is a cross reference to text 15 with a
description that reads "Check this out!".
783

David Byers's avatar
David Byers committed
784 785
The inherit bit is automatically cleared and the item can always be
deleted. 
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818


@item no-comments [4] (text)
When this item is set, the author requests that nobody comments the
text. This is advisory only; it is still possible to write comments, but
clients should advise the user that this is contrary to the author's
wishes. Data should be empty.

This item may only be set by the author. The secret, hide-creator and
inherit bits are automatically cleared.


@item personal-comment [5] (text)
When this item is set, the author requests only personal comments. This
is advisory only; it is still possible to create regular comments, but
clients should advise the user that the author prefers a personal
comment. Data should be empty.

This item may only be set by the author. The secret, hide-creator and
inherit bits are automatically cleared.


@item request-confirmation [6] (text)
The author requests that everyone who reads the text confirms having
done so by creating read-confirmation items on the text. Clients should
ask users if they wish to confirm having read the text when it is
displayed. Data should be empty.

The hide-creator, secret and inherit bits are automatically cleared.


@item read-confirm [7] (text)
This item can be taken as confirmation that the item creator has read
819 820 821
the text to which the item is attached. Clients should never ever create
this item without an explicit confirmation from the user that the text
has indeed been read.
822 823

The hide-creator, secret and inherit bits are automatically cleared.
David Byers's avatar
David Byers committed
824
Once created an item of this type cannot be deleted.
825 826 827


@item redirect [8] (conference)
David Byers's avatar
David Byers committed
828

David Byers's avatar
David Byers committed
829 830 831 832 833 834 835 836 837 838 839
This item indicates that texts should not be sent to the conference,
but be directed to some other target instead. Clients should notify
users that attempt to send texts to the conference of the redirect and
offer to send the text to the target of the redirect instead. A typical
use of this item would be a user that does not read LysKOM very often
and would like to advise other users to send e-mail instead.

Data is PROTOCOL:ADDRESS where PROTOCOL is either "E-mail" or "LysKOM",
and ADDRESS is either an e-mail address or a LysKOM conference. 
Hopefully we'll be able to replace this with a forwarding mechanism
later.
840 841

This item can only be set by the conference supervisor or in the case of
David Byers's avatar
David Byers committed
842
a mailbox, the person attached to the mailbox. The hide-creator and
843 844 845
secret bits are cleared automatically. Only one redirect can be
specified.

David Byers's avatar
David Byers committed
846

847 848 849 850 851
@item x-face [9] (conference)

Data is the face of the person in compface format. Cool, innit?

This item can only be set by the conference supervisor or in the case of
David Byers's avatar
David Byers committed
852
a mailbox, the person attached to the mailbox. The hide-creator and
853 854 855
secret bits are cleared automatically. 


856
@item alternate-name [10] (text, conference)
857 858

Data is a string that the client may use as an alternate to the name of
David Byers's avatar
David Byers committed
859 860 861
a conference or the subject of a text. Note that the server does not
match against this name when performing name lookups. Clients should
only display alternate names created by the user currently logged on.
862 863 864 865 866 867 868

The inherit flag is automatically cleared.


@item pgp-signature [11] (text)

Data is a PGP signature of the text. The signature should be the
David Byers's avatar
David Byers committed
869
equivalent of what "pgp -sba" in PGP 2.6.2 generates.
870 871 872 873 874 875 876 877 878 879

The secret, hide-creator and inherit bits are automatically cleared.
Signatures cannot be deleted once they have been created.


@item pgp-public-key [12] (letterbox)

Data is the public key of the person. It is desirable that the public
key contains a userid of the format "LysKOM <p\([0-9]\)@@\(.*\)>+", where
\1 is the number of the person in the LysKOM server specified in \2.
David Byers's avatar
David Byers committed
880
This rule is currently not enforced.
881 882 883 884

This item can only be set by the person himself. The hide-creator,
secret and inherit bits are automatically cleared.

David Byers's avatar
David Byers committed
885

886 887
@item e-mail-address [13] (conference, letterbox, server)

David Byers's avatar
David Byers committed
888 889
Data is an RFC 822-style email address. When set on a mailbox, it
should be the email address of the person. If the person has multiple
890 891 892
email addresses he may set serveral e-mail-address aux-items.

The meaning of this aux-item when set on a conference that isn't a
David Byers's avatar
David Byers committed
893 894 895
mailbox is vague. For a conference that is used as to import a mailing
list this should be the email address of the list. For other conferences 
we haven't really defined a sensible use.
896 897 898 899

When this aux-item is set on the server it shold contain the email
address of the administrator (or administrators).

David Byers's avatar
David Byers committed
900 901 902
This aux-item can only be set by the supervisor of a conference or the
server administrator. The creator cannot be hidden.

903 904 905 906

@item faq-text [14] (conference, server)

Data is a decimal text number, which is a FAQ for the conference (or
David Byers's avatar
David Byers committed
907 908 909 910 911 912 913
server).  This aux-item can only be set by the administrator. Adding
this item to a conference or to the server automatically marks the text.
Deleting the item unmarks the text. 

This item can only be set by the supervisor or server administrator. The 
hide-creator, secret, and inherit bits are automatically cleared.

914 915 916 917 918 919 920 921 922 923 924 925

@item creating-software [15] (text)

Data is the name and version number of the client that created the
text.  This aux-item can only be set by the author of the text.  Once
set, it cannot be removed or changed.  A typical value would be
@samp{elisp-client 0.47.3}.  Setting the creating-software aux-item is
optional.

The data should be the client name, a space, and the client version used
in the @code{set-client-version} call.  The server may enforce this
restriction.
926

927
@item x-author [16] (text)
928 929 930 931 932 933

For imported texts using email gateway. Data is a string with
the (readable) name of the author.

Kom clients should show this field instead of the id of the importing kom-id.

934
@item x-from [17] (text)
935 936 937 938

Data is a plain email addres, the From: field from an imported email.
Used by the kom client to construct an email reply to an imported text.

939
@item x-reply-to [18] (text)
940

941 942
Data is a plain email addres, comes from the Reply-To: field in the
imported email.
943

944
@item x-to [19] (text)
945

946
Data is one email address can be in variable format. Multiple x-to
947 948 949 950 951 952
can be present. The format is the same as is allowed in To: fields in
emails. If the text is imported these are the other receivers as seen in
the email. If the text originates from a kom-person (and thus not an
importer) this field is used in constructing an email, if an exporter
is present.

953
@item x-cc [20] (text)
954

955 956
Data in the same format as for "x-to", usage the same but will
be a carbon copy instead when exported.
957

958
@item x-date [21] (text)
959

960
Data is the send-date of an imported email. Can be in free format, even
961 962 963 964 965
if a readable format, such as "YYYY-MM-DD hh:mm:ss", is preferred. Kom
client should display this date as originating date, date of the
imported text entity in kom may be different (and can be shown as
received). In case of the text being exported from kom, this date is set
by the exporter.
966

967
@item x-message-id [22] (text)
968 969

Data is a string which is the message id from the imported email.
970 971 972 973 974 975 976 977
Message id does not contain the enclosing < >. Preferably the importer
should only add receivers when importing the same email more times with
the same msg-id. When a text is exported, the x-message-id is
constructed as an email address which contains the kom text number and
server in an unique way. (x-message-id is generally generated by the
exporter as follows.  A kom text that is exported is copied to the
importer, the importer sets the fields in the originating kom text which
it normally would set when importing.) Preliminary, the format is
978
"Text-<textno>@@<lyskomserver>".  Lyskom server takes the same format as
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997
vaguely defined in aux-info pgp-public-key [12].

@item x-in-reply-to [23] (text)

Data is a string which stores one "In-Reply-To:" msg id from the
email. If several msg ids are present all of them have one x-in-reply-to
each. The stored msg id has the same format as x-message-id.  For each such
text a kom (comment) link should be created by the importer if these
referenced emails previously has been imported. Exporters must set this
for kom texts that are exported as emails, if the text is a
comment. Multiple x-in-reply-to can exist.

@item x-misc [24] (text)

Data is a string that contains all of the headers (incl subject:),
including whose that are redundantly stored in other aux-items. It is
set by the importer. The fields are concatenated with "\n".

@item x-allow-filter [25] (conf)
998 999

Data is a regexp string which allows a sender (a field in the
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
email-header) to import the message. If none is present, the text is
imported. Several filters can exist, however, it is enough if one
positive filter matches (OR) and none negative dissallows (AND)
import. The order is of no importance. Can be set by an organizer of the
conference.

The regexp is case insensitive, and use a glob-pat style, it allows
[^]?*+(|) as constructs. Note that "." is literal. The importer is
required to check these when adding recipient of an imported text and
comply. Example of usage: (positive filter) "From:*.liu.se*",
"From:*jsk*". "From:*(jonas|jonka|jsk)*" Tests are not made on the
text-body.
1012 1013

However, if the string starts with a "!" the email will be rejected if
1014
the there is a match (negative filter), even if one of the filter allowed it.  Example:
1015 1016
"!From:*aol*", "!Subject:*money*". 

1017
@item x-reject-forward [26] (conf)
1018

1019 1020 1021
Data is a string with either an email name on the same format as
aux-info rediret [8]. The mail is forwarded to this address if it was
rejected by "x-import-filter".
1022

David Byers's avatar
David Byers committed
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032
@item notify-comments [27] (letterbox)

Data is a decimal text number that the user is interested in. Clients
should monitor this text for unread comments and present these to the
user in some convenient manner. This is typically used by users that
want to read comments to some text of theirs as soon as they arrive,
rather than in the normal reading order.

This item can only be set by the owner of the letterbox. No flags are
forced or cleared.
1033 1034


David Byers's avatar
David Byers committed
1035 1036
@end table

1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070

@node Client-Specific Aux-Item Types, Experimental Aux-Item Types, Predefined Aux-Item Types, The Aux-Item List
@subsubsection Client-Specific Aux-Item Types

Client-specific items do not cause the server to perform any magic. All
the flags (except the delete flag) are left untouched, the data is not
validated in any way, and anyone can create any item. If you need more
server support than this, your item should be on the predefined list.

All tags in the range 10000-19999 are reserved for clients. Blocks of
100 numbers at a time can be assigned to specific clients. A client
should never create items with tags in a range assigned to another
client or in an unassigned range. Assigned ranges will never change.

Currently, the following ranges are assigned to clients:
@itemize @bullet
@item 10000-10099: The Elisp Client
@end itemize

If you want a range of numbers, send e-mail to the LysKOM development
group.


@node Experimental Aux-Item Types, Defining New Aux-Item Types, Client-Specific Aux-Item Types, The Aux-Item List
@subsubsection Experimental Aux-Item Types

Experimental numbers are free for all. Use 'em any way you want. All
numbers in the range 20000-29999 are for experimental use. 



@node Defining New Aux-Item Types, , Experimental Aux-Item Types, The Aux-Item List
@subsubsection Defining New Aux-Item Types

1071
If you want a new predefined item type, just document what it does, what
1072 1073
the data format looks like and what the server is to do with the item
and send this to the LysKOM development group. We'll assign a number to
1074
your item and put the documentation in this document. 
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094

If you're not sure what you want the data to look like yet, make a note
in your documentation that the data format might change. Once you have a
data format you're happy with, update the documentation so others may
use your item.

If you need serious magic in the server (more than can be specified with
the lyskomd configuration file), you'll probably have to write the code
yourself, or hope that the development group thinks your idea is so cool
we do the job for you.

The idea is not to reject any type of item, unless there's already an
item type that does the job just as well. Adding item types should be a
much less painful process than adding new calls.





@node Security, Membership and Reading, The Aux-Item List, Introduction
David Byers's avatar
David Byers committed
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170
@subsection Security

Security in LysKOM is based on two components. Each person has a set of
privileges and each session has a security level. Rights in the system
require both the sufficient privileges and a sufficient security
level. The privileges currently available are wheel, admin, statistic,
create-conf, create-pers and change-name. Security levels range from 0
to 255.


@table @code
@item wheel
@emph{Normally not assigned}
@table @asis
@item Level 0
Person may always log in, even when LysKOM is crowded.
@item Level 6
Person may set Priv-Bits for all persons.
@item Level 7
Person may set password for all persons.
@item Level 8
Person acts as supervisor for everything.
@item Level 10
Person can read all articles.
@end table

@item admin
@emph{Normally not assigned}
@table @asis
@item Level 1
Shut down the server@*
Set motd_of_kom@*
Read last_login
@item Level 2
Read status of secret conferences and persons@*
Read the protected parts of person and conference statuses@*
Read the entire text status, even when there are secret recipients
@item Level 3
Change everybody's names
@item Level 4
Add/remove members@*
Add/remove recipients to articles
@item Level 5
Set super-conference@*
Remove articles
@item Level 6
Set administrator
@end table

@item statistic
@emph{Normally not assigned}
@table @asis
@item Level 2
Read the statistics portions of persons, even if protected
@end table

@item create_conf
@emph{Normally assigned}
@table @asis
@item Level 0
Create conferences
@end table

@item create_pers
@emph{Normally assigned}
@table @asis
@item Level 0
Create persons
@end table

@end table


@node Membership and Reading, Client-Server Dialog, Security, Introduction
@section Membership and Reading

1171
Persons' memberships in conferences are represented in the protocol as
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194
arrays of @code{Membership}-typed values. This structure contains
information about how and when the membership was created and which
texts have been read in the conference.

There are two kinds of memberships. An active membership indicates that
the person is actively participating in the conference, wants to know if 
there are unread texts and wants to receive messages send to the
conference. A passive membership is similar to no membership at all. The 
person is still a member but will not receive messages sent to the
conference and will not be notified when there are new texts. From the
user's perspective, passive membership should be like no membership at
all, but the server still remembers what the user has read in the
conference while he or she was an active member. Since protocol version
10 a bit in the membership type field of the membership structure
indicates the type of membership. Previously the server did not support
passive memberships, but there was a convention that clients should
treat the priority level zero as a passive membership.

The membership record indicates which texts have been read through the
@code{last-text-read} and @code{read-texts} fields. All texts with local 
numbers up to @code{last-text-read} have been read. In addition, all
texts with local numbers contained in the @code{read-texts} array have
been read.
David Byers's avatar
David Byers committed
1195 1196

Finding out which articles a person has read in a particular conference
1197 1198
requires a few calls. Normally, a client will retrieve a batch of
perhaps 50 articles at a time. The outline of the process is as follows:
David Byers's avatar
David Byers committed
1199 1200 1201

@enumerate
@item Fetch the membership to get the @code{last-text-read}
1202 1203 1204 1205
@item Use @pxref{local-to-global} to translate a number of local numbers 
to global numbers. 
@item Remove the global numbers corresponding to local numbers contained 
in @code{read-texts} from the result
David Byers's avatar
David Byers committed
1206 1207 1208
@item Get and translate more texts as needed.
@end enumerate

1209
The process is complicated because of the translation between local and
1210 1211 1212
global text numbers. If the server does not implement the
@code{@pxref{local-to-global}} call, it is possible to use the less
efficient but perfectly serviceable @code{@pxref{get-map}} call instead.
David Byers's avatar
David Byers committed
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223


@node Client-Server Dialog, ,Membership and Reading , Introduction
@section Client-Server Dialog

The client-server dialog consists of two phases, establishing the connection
and the LysKOM session itself.

@subsection Connecting to the Server

A connection to the server is initiated by connecting to the appropriate
1224 1225 1226 1227
network port@footnote{The default port for a LysKOM server is 4894} and
sending a single letter which is used to select a protocol version
followed by connection information required by that protocol. In
protocol A the connection information is a Hollerith string saying who
1228
the user connecting is followed by a newline character.
David Byers's avatar
David Byers committed
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242

When the server has accepted the connection its reply is
protocol-dependent. Protocol A servers will reply with the string
@code{LysKOM} on a single line.

@example
        % telnet kom.lysator.liu.se
        Trying 130.236.254.151 ...
        Connected to varg.lysator.liu.se.
        Escape character is '^]'.
        A5Hbyers
        LysKOM
@end example

1243 1244 1245 1246
After connecting, calls to the server can be made. Most calls require
the user to log in, but some calls can be made without a log-in. Calls
to the server are made by sending a reference number followed by the
call as specified.
David Byers's avatar
David Byers committed
1247 1248 1249 1250 1251 1252 1253 1254

@example
        server-call ::=
                ( ref-no        :       INT32;
                  request       :       Protocol-Request;
                )
@end example

1255 1256 1257
At some future point the server will reply with the result of the
request or an error code preceded by an indicator and the reference
number.
David Byers's avatar
David Byers committed
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271

@example
        server-reply ::= ok-reply | error-reply;

        ok-reply ::=
                ( "="
                  ref-no        :       INT32;
                  reply-data;
                )

        error-reply ::=
                ( "%"
                  ref-no        :       INT32;
                  error-no      :       Error-No;
1272
                  error-status  :       INT32;
David Byers's avatar
David Byers committed
1273 1274 1275 1276 1277 1278
                )

        error-no ::= INT32;
@end example

Our notation is not flexible enough to specify the two-way nature of the
1279 1280 1281 1282 1283 1284
communication. @code{ref-no} in the reply is always the same as
@code{ref-no} in the corresponding request. @code{reply-data} depends on
which request was made and is specified together with each request.

Please note that there is no whitespace after the initial indicator in
the reply.
David Byers's avatar
David Byers committed
1285

1286
Error reporting is covered in more detail in chapter @ref{Error Codes}.
David Byers's avatar
David Byers committed
1287 1288 1289 1290 1291


@node Data Types, , , Top
@chapter Data Types

1292 1293 1294 1295
The data types in protocol A come in two flavors. The first (vanilla)
are the simple data types from which the LysKOM (chocolate) data types
are built. Simple data types include things like integers and strings
while complex data types include things such as conferences and people.
David Byers's avatar
David Byers committed
1296 1297 1298 1299

@menu
* Simple Data Types::
* LysKOM Data Types::
1300
* Name Expansion::
David Byers's avatar
David Byers committed
1301 1302 1303 1304 1305
@end menu

@node Simple Data Types, LysKOM Data Types, Data Types, Data Types
@section Simple Data Types

1306 1307 1308 1309 1310
Data elements are sent from client to server separated by one or more
ASCII spaces (0x20), tab characters (0x09), line feeds (0x0A) or
carriage returns (0x0D.) In messages from server to client the data
elements are separated by exactly one space character and the entire
message terminated with a line feed.
David Byers's avatar
David Byers committed
1311 1312 1313 1314


@subsection Integers

1315 1316 1317 1318
@tindex INT32
@tindex INT16
@tindex INT8
@tindex BOOL
1319 1320 1321
@dfn{INT32}, @dfn{INT16}, @dfn{INT8} and @dfn{BOOL} are non-negative
integers which must fit in 32, 16, 8 and 1 bits, respectively. They are
transmitted to the server in ASCII-encoded decimal notation.
David Byers's avatar
David Byers committed
1322 1323 1324 1325


@subsection Strings

1326
@tindex HOLLERITH
David Byers's avatar
David Byers committed
1327 1328 1329
@dfn{HOLLERITH} denotes character strings of arbitrary length. They are
transmitted as @code{<n>H<text>} where @code{<text>} is the string and
@code{<n>} is the number of characters in @code{<text>} in decimal
1330 1331 1332 1333
notation. All byte values are allowed in the string itself, including
nulls.

Long live FORTRAN!
David Byers's avatar
David Byers committed
1334 1335 1336 1337 1338



@subsection Bit Strings

1339
@tindex BITSTRING
1340 1341
@dfn{BITSTRING} is a string of bits, commonly used for a set of
boolean-valued flags. Bit strings are denoted as
David Byers's avatar
David Byers committed
1342 1343 1344 1345 1346

@example
        BITSTRING ( name-1; name-2; name-3; ... )
@end example

1347 1348
in this specification. They are transmitted as a sequence of ASCII ones
and zeroes in the order the fields are listed.
David Byers's avatar
David Byers committed
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360

For instance, given the specification

@example
        shape-of-world : BITSTRING (
                is-flat;
                is-round;
                is-2d;
                is-3d;
        )
@end example

1361 1362
most peoples idea of @code{shape-of-world} would be sent as @code{0101}
(round and three-dimensional.)
David Byers's avatar
David Byers committed
1363 1364


David Byers's avatar
David Byers committed
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404
@subsection Enumerations

@tindex ENUMERATION
@dfn{ENUMERATION} is an integer constant. It is transmitted as an INT32, 
but only fixed values are permitted. Clients should be prepared to
receive numbers outside the enumeration and either handle this
gracefully as an error or use a reasonable default value in place of an
invalid enumeration value.

An enumeration is specified as 

@example
        ENUMERATION ( 
                name-1=value-1;
                name-2=value-2;
                name-3=value-3;
                ...
        )
@end example

This specification states that name-1 is represented by the integer
value-1, name-2 is represented by value-2 and name-3 is represented by
value-3. 

For example, in the following specification, the constant guwal will be
transmitted as the integer 2, ciokwe as the integer 3, and hopi as the
integer 5.

@example
        language : ENUMERATION ( hakka      = 1;
                                 guwal      = 2;
                                 ciokwe     = 3;
                                 yoruba     = 4;
                                 hopi       = 5;
                )
@end example




David Byers's avatar
David Byers committed
1405 1406
@subsection Arrays

1407
@tindex ARRAY
1408 1409 1410
@dfn{ARRAY} is a list of a fixed number of elements of a single type.
The specification for an array is @code{ARRAY <type>} where
@code{<type>} is the type of the array elements.
David Byers's avatar
David Byers committed
1411

1412 1413 1414 1415 1416
Arrays are transmitted as an @code{<n> @{ <element> <element> ... @}}
where @code{<n>} is the number of elements and each @code{<element>} is
an element of the array. A special case is when the array is empty, in
which case the server transmits it as @code{0 *}. Note that the client
must always transmit empty arrays as @code{0 @{ @}}.
David Byers's avatar
David Byers committed
1417

1418 1419 1420
In some calls the client can ask the server not to send the array
contents, only its length. In these cases the array is transmitted as
@code{<n> *} where @code{<n>} is the number of elements in the array.
David Byers's avatar
David Byers committed
1421 1422 1423 1424


@subsection Selection

1425
@tindex SELECTION
1426 1427
@dfn{SELECTION} is tagged data. It consists of an INT32 selector
followed by a tail of an arbitrary type and is specified as
David Byers's avatar
David Byers committed
1428 1429 1430 1431 1432 1433 1434 1435 1436

@example
        SELECTION (
                <n>=<name>        <tail> : <type>;
                <n>=<name>        <tail> : <type>;
                ...
        )
@end example

1437 1438 1439
where each @code{<n>} is the selector value, @code{<name>} the selector
name and @code{<tail>} the name of the selector tail and @code{<type>}
its type.
David Byers's avatar
David Byers committed
1440

1441 1442 1443
When transmitted, the selector is transmitted as an INT32 followed by
the tail belonging to that selector. For instance, given the
specification
David Byers's avatar
David Byers committed
1444 1445 1446 1447 1448 1449 1450 1451

@example
        phrase : SELECTION (
               1=hello          name : HOLLERITH;
               2=howdy          ;
        )
@end example

1452 1453
two legal messages of the type @code{phrase} are @samp{1 4HJohn} and
@samp{2}.
David Byers's avatar
David Byers committed
1454 1455 1456 1457


@subsection RPC

1458
@tindex RPC
David Byers's avatar
David Byers committed
1459 1460 1461 1462 1463
@dfn{RPC} is a notation used to specify calls to the server. An RPC
specification has the following form:

@example
        RPC (
1464 1465
                <call> <<n>> ( <request> ) -> ( <reply> ) ;
                <call> <<n>> ( <request> ) -> ( <reply> ) ;
David Byers's avatar
David Byers committed
1466 1467 1468
        )
@end example

1469 1470 1471
where each @code{<call>} is the name of a call, @code{<n>} is the call
number, @code{<request>} is a single data element sent as a request and
@code{<reply>} is a single data element sent in reply from the server.
David Byers's avatar
David Byers committed
1472

1473
RPC calls are transmitted as @code{<n> <request>} where @code{<n>} and
1474 1475 1476 1477
@code{<request>} have the same meaning as above. Note that in the
client-server dialog a reference number must also be supplied with each
request. This reference number is not part of the RPC itself, but is
required for communications @xref{Client-Server Dialog}.
David Byers's avatar
David Byers committed
1478 1479 1480 1481 1482



@subsection Structure

1483 1484
Structures are collections of several data items. In the specification
they are written as
David Byers's avatar
David Byers committed
1485 1486 1487 1488 1489 1490 1491 1492

@example
        ( <name> : <type> ;
          <name> : <type> ;
          ...
        )
@end example

1493 1494
where each @code{<name>} is the name of a data field and the
corresponding @code{<type>} is its type.
David Byers's avatar
David Byers committed
1495 1496 1497 1498

Structures are transmitted as a sequence of their fields.


1499
@node LysKOM Data Types, Name Expansion, Simple Data Types, Data Types
David Byers's avatar
David Byers committed
1500 1501
@section LysKOM Data Types

1502 1503 1504 1505
In this section the data types specific to LysKOM are defined. Most of
these will probably make very little sense until you know what calls
there are. This section does not include the server calls or
asynchronous messages, even though these are also data types.
David Byers's avatar
David Byers committed
1506 1507 1508 1509 1510 1511

Since the types defined here are all based on the simple types, the
definitions are more concise in this section.

@subsection Common Types

1512 1513
The types defined in this section are fairly simple and used in many of
the more complex data types.
David Byers's avatar
David Byers committed
1514 1515 1516

@subsubsection Time

1517
@tindex Time
David Byers's avatar
David Byers committed
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531
@example
        Time ::=
              ( seconds         :       INT32;
                minutes         :       INT32;
                hours           :       INT32;
                day             :       INT32;
                month           :       INT32;
                year            :       INT32;
                day-of-week     :       INT32;
                day-of-year     :       INT32;
                is-dst          :       BOOL;
              )
@end example

1532 1533 1534 1535 1536 1537 1538 1539
@code{Time} is used to specify times in several data structures. The
fields @code{seconds}, @code{minutes} and @code{hours} give wall clock
time. @code{day} is the day of month and @code{month} is the current
month, starting with zero for January. @code{year} is the number of
years since 1900. @code{day-of-week} is the current weekday, with zero
used for Sunday. @code{day-of-year} is how many days of the year have
passed starting with zero and @code{is-dst} is true when the time
indicated is daylight savings time.
David Byers's avatar
David Byers committed
1540

1541 1542
When the server receives a @code{Time} structure from a client it
ignores the @code{day-of-week} and @code{day-of-year} fields.
David Byers's avatar
David Byers committed
1543 1544 1545 1546 1547

All times are expressed in the time zone of the server.

@subsubsection Conference Numbers