CVE Network Protocol

by Clinton Jeffery, with help

This document describes version 0.4 of the CVE Network Protocol. The document historically served as a design document and was not strictly followed. The implementation has not implemented some of the message types proposed here, and various additions to the implementation are not described here or are inadequately described. This situation is under repair.

At present:

Any or all of these statements may evolve in future, or be not quite current. For example, the monolitich server might be split in future into multiple processes, enabling increased performance and scalability at the cost of increasing the number of TCP connections and the complexity on the server side.

Requirements

The CVE protocol has the following requirements:

Design

The protocol design section should include syntax of messages in general; sort of the general packet parsing. It starts with
\command arguments* \n
Most commands are short, but some commands are quite long, including tasks such as sending messages with many text lines in them. Newlines are "escaped" (replaced by a substitute string) in such messages. TCP does not guarantee delivery of an entire command in a single packet. The client and server must remember incoming unfinished commands in a buffer until the packet containing their newline is received. Multiple commands are generally batched into a single packet in order to reduce OS overhead.

Protocol Message Types by Example

These examples convey the flavor of the protocol. This list is not complete nor entirely correct. Things that are/were planned but not implemented should be moved down to the future work section.

Some of these items are really local client commands, not network protocol commands. For each command we need to ask: does it need to go the server? and then: which client(s) should the server forward it on to? and then: does it require a reply, and if so, from whom? Lastly: for each command, does it require that the server remember the state change and store it in a database?

Every command can be abbreviated by a unique prefix. Common commands can be abbreviated with nonunique prefixes. Each client avatar has a current default command which executes for lines not beginning with \.

Login/Logout

The server and client both have to handle connection drops and reconnects, but there are explicit messages to identify oneself on startup (two lines, required) and a command to terminate a session cleanly. Server also has to garbage collect sessions that don't terminate cleanly.
Example Description
\login [-cvecypher] userid passwd [npc] log in; server replies "Valid"
\version identify CVE protocol; server replies Valid Version #.#
\logout log out

Chatting

Implemented:

Example Description
\say hello chats to the current room
\tell joe hello chats to a specific person

Maybe Not Yet Implemented:

Example Description
\tell groupname hello chats to a specific group
\tell sessionname hello chats to a specific session
\group hello chats to the current group
\sig hello chats to the current special interest group
\course hello chats to the current course
\emote a supposedly non-verbal

Account Creation

Example Description
\newuser id password firstname lastname email affiliation register a new user; server replies Valid

Establishing groups

There are the following types of groups:
session
A session is a temporary membership chat group for the current-session. A collaborative file-editing session ought to be (but is not yet) a special case of this which has associated files being edited.
sig
This is the persistent membership, generic chat group
course
This is a persistent membership group with extra structure and permissions for academic courses.
Example Description
\invite invite (currently selected person) to join group
\disband disband current group
\groups list my groups
\lsgroups list all groups
\makesig unicon [closed] Create a special interest group. The default is an open sig. An optional parameter would create a closed/moderated sig. Closed is the default for all types of groups other than sigs.
\makecourse cs371 create a course
\sig=unicon sets the current/default special interest group you are sending to
\unicon sends a message to any sig by name
\join unicon join (subscribe to listen) a sig
\course cs371 sets the current course you are sending to
\ignore joe discard all messages from user joe
At one point, a discussion produced the following proposed additions:
Example Description
\createsession sessionname sessionid server assigns id to created (temporary) group
\destroysession sessionname destroy a (temporary) group
\subsession sessiontype sessionname create a subgroup
\invite sessionname username(s) client invites user(s) to join group
\invite sessiontype sessionname server forwards invitation to user(s) to join group
\join sessionname accept membership
\decline sessionname decline membership
\leave sessionname exit membership
\dismiss sessionname username kick someone out
\listsessions client requests
\listsessions ssnname, ssntype, ssnname, ssntype, ... server responds
\listmembers sessionname
\requestcontrol sessionname
\releasecontrol sessionname
\givecontrol sessionname username

Avatar and Virtual Environment manipulation

Example Description
\goto 0,0,3.5 move to (x,y,z)
\goto sh371 move (teleport) to sh371
\goto spock move (teleport) to user spock
\look get a 2D detailed look at nearest 2D object
\look board get a 2D detailed look at the nearest whiteboard
\look screen get a 2D detailed look at the nearest PC screen
\look up go back to 3D view
\look 0,0,3.5 (turn and) look at (x,y,z)
\pen red set the current pen to red
\whiteboard sh118b-a set/lock the current whiteboard to sh118b-a
\draw 50,50 set (x,y) on the nearest board to current pen color
\drawline 50,50,55,30 draw line from (x,y)-(x2,y2) on the nearest board to current pen color
\fillrectangle 50,50,10,10 fill rectangle from (x,y) with (width,height) on the nearest board to current pen color
\erase erase the nearest board
\door toggle nearest door more open or closed
\hand toggle (raise/lower) hand
\follow follow the currently targeted user
\voice [on off] enable disable realtime microphone
\sound [on off] enable disable realtime speaker
\video [on off] enable disable realtime videocamera feed

File Transfer

Example Description
\putfile dat/avatars/curtis.avt 206 dat/avatars/curtis.avt is the file to upload, and it is 206 bytes. Immediately after the newline (after the 6) the actual contents of the file (ASCII or binary; use writes()/reads() for no newline-handling) would be sent.
\getfile dat/avatars/curtis.avt this asks the server to execute a \putfile
Issues:

Miscellaneous

Example Description
\quit! exits immediately
\exit exits with a grace period
\afk marks you as away from keyboard
\who show who is on the system
\loc shows your current location
\log [on off] turns on/off your private recorder
\cmd say sets the default command to \say

Teacher/lecture tasks

Example Description
\give joe pen give joe permission to draw on the board
\give joe voice give joe permission to speak
\give joe legs give joe permission to move
\take joe ... remove students' specific permissions
\stop joe remove all of joe's permissions, he is paralyzed

Administrator tasks

Example Description
\enroll joe cs371 adds joe to a class
\kill joe dumps joe out of the application
\lock joe prevents joe from logging in any more

Collaborative IDE and Browser Protocol

Issues:

Future Work

UDP

Those interactions which are transient (e.g. avatar motion) are appropriate for a UDP subsystem.

Model Editing

The purpose of a Model Editing subsystem in the protocol is to allow dynamic changes to the CVE model to be seen by others. A module that is of particular interest in planning for such a protocol is model/CVEBuilder.icn, which reads/parses .dat files and constructs virtual objects from them. Some basic issues include:

Editing Message Description
\make class name params create a new virtual object
\move name params alter coordinates of virtual object
\edit name param=val ... alter attributes of virtual object
\texture dat/uidaho/jeb121/sign.gif ... upload a texture

Examples:

\make Room bedroom5 13.2 0 11 5 3.3 4.4
(          name       x  y  x w  h   l  texture (defaults) )
\edit bedroom5 floor=floor.gif

Command Reference

src/common/commands.icn lists approximately (as of 2011) 214 commands, while this document documents around 60 of those commands, and in many cases it is incorrect. What all are in commands.icn that aren't in this document?

For each command, there is the command name and syntax on the left side of a header line. The right side of the header line will contain the word client, server, or both to indicate whether the command is sent by clients (to server), by server (to clients) or both. The body of the command entry gives the semantics of the command, and indicates if it is issued asynchronously at any time, or only occurs in a specific command context, i.e. in response to another command. By default you can imagine a static virtual world in which the server is a stateless forwarder of chat messages. In that situation, it would make sense for the default source to be both and the default context to be asynchronous, i.e. it can be sent at any time.


admin:list

list users / userlist()


admin:add [args]

add a user / useradd()


admin:remove

remove a user / userrem()


admin:change

change a user / userchange()


admin:quit

quit and kill / shutdown()


allow


allusers

Send client a list of all users / all_users()


attrib


avatar [userid]

Instantiate an avatar of someone who has logged in.


avtroom


back


changereg


close


cmd


color


course


dat


delavatar


disband


door


doorMotion


draw


dynstate


emote


enroll


erase


exit


failure


follow


fetchip

sends a fetchip message to client; compare with getip


getip [userid]

sends a \say message to client telling me userid's (external) IP# (defaults to my own), for peer-to-peer purposes


give


group


groups


gvstate


hand


history


ignore


inform


invite


join


kill


latency

send user a response, allowing them to measure latency of their connection


loc


lock


log


logwatch

subscribe to a loghandler / logHandler.subscribe()


login


logout


move


moveavatar [position]

Move an avatar to [position] / moveAvatar()


movedoor [setting]

Set the door openness to [setting]. Transmit to clients as a \doorMotion.


newuser


nodechange


npcmsg


passwd


pen


possess


query [question]

Ask a question (this is vague). / query()


quit!


redraw


request


say

Send a chat to all users. Could reduce scope to "nearby within earshot" users.


server


set


setip


sound


stop


stoplogwatch


success


switchobjectup


switchobjectdown


take


tell


transfer


unpossess


update


uptime


users

send client a list of logged in users / who_is_up()


vaccept


vchroom


version


vhold


video


vlocal


vlend


voice


vpend


vphone


vreject


vrequest


vroom


vstate


vuhold


vwho


vrtalk


vtalk


vend


vgetip


who


IDErequest


WEBopen

Send the user a webpage? / Url_Send()


CETLevent


CETLmouse


CETLkey


CETLscrol


SHLevent


SHLmouse


SHLkey


SHLscrol


CETLaccept


Addusers


CETLOpen


DeleteUser


CETLCompile


RejectIDE


Whoami


CETLDeletefile


CETLDeleteEntry


CETLSendUser


CETLLock


CETLLockTransfer


CETLRemoveUser


SHLHighlight


CETLPaste


CETLhostuser


SHLResize


groupInvite


groupRemove


groupWall


userRemove


sciAdduser


groupJoin


groupLeave


inviteAccept


makesig


addFriend


addFriendAccept


userProfile


getAccountSettings


setAccountSettings


getPrivacySettings


setPrivacySettings


addFeed userID contents @@ flag who_is_allowed : objName

Add a new news feed. Feed label/name is contents, which if longer than 30 characters may be truncated. Who_is_allowed (to post) can be ALL, or a specific user.


removeFeed feedlabel @@ replylabel @@ flag userID

Remove a news feed.


viewFeed


replytoFeed


changeStatus


projfileOpen


projfileClose


commitChanges


readytoCommit


getProjectInfo


projectInvite


makeProject


projectDelete


projectInvite


projectJoin


projfileAdd


projfileDelete


checkdiff


ADDPending


DELPending


FWDPendingSuggest


sendToGroup


getEmail


setPermissions


projActivity


memberActivity


projMembersLst


memberProjectsList


getAccessedProjFiles


updateChangedLines


storeChangedLines


storeUpdatedLines


membersColorList


setIDESession


getUpdatedLines


getChangedLines


checkMemberColor


setMemberColor


writeToWall userID msg

This NewsFeed command is supposed to put a persistent message on someone's "wall", even when they are not logged in. Such messages are stored on the server in userID/wall.log


projTooltip


sessionTooltip


sessionActivity


blockUser


getExpertsList


avatlocation


userAvailability


createroom [8 room stats]

Create a (new/additional) room in the world. Tell other clients about it.


teleport


saveroom roomname&FLAGdata

Save a room. This writes (on the server) a roomdat/roomname.dat file that contains @ for newline, # for tab, and ~ for spaces. It also writes (if FLAG is 1) a new include line in roomdat/roomlist.dat, and maybe adds that file to the ServerUpdate.tim file so clients will download it.


createDatFile


checkforupdates

Check server for updates. Checks ServerUpdate.tim, containing a list of file[\t]time strings. For every file missing or outdated, send a \createDatFile [contents] message. Contents is filename[\t] followed by the file contents, with $ for newline. Appears not to work for binary files. After the last file, send a \createDatFile BREAK command.


userTimeSpent


userProgress


saveopening


updatelocations


myFriendsList


interactionsIn3D


projTeleport


unblockUser


delWallPost userID objType objName postName

Remove the named wall post. objType is Group or Project


myPartnersList


addWallPost userID objType objName addPostId ppriority pcontents

Add a (persistent) wall post. objType is either Group or Project. The post is written to objName/Wall/userID~priority[postID].log and added to the members' communication logs. The format of a wall post is

User: userID      Date/Time: date and time
==================================================
contents
where contents uses $$ to encode newlines.


replyWallPost userID objType objName postName contents

Reply to an existing post. Replies are appended to objName/Wall/postName on the server.


refreshWall


myProjectsList


objDescription


getDescription


setDescription


usersAvailability


editroom

Unimplemented (Proposed) Commands


addopening

insert an opening into the world.


\createsession sessiontype sessionname

Create a (temporary) group. There are various possible applications, such as to incorporate mini-games, as special collaborative sessions.