Remote write protocol should allow non-local users to write on your terminal. It should be even used by local users - as there's much better control over it. There should be no more programs like write, in.talkd, comsat, etc. running setgid tty. As user have oportunity to make all writes go through his program, it's also chance that sometime in future writing on one's tty will no longer trash his display.
Remote write protocol uses TCP port 654 (rwrite). After connection, remote side has to pass 4 lines (separated with LF = \x0a):Name of target user
Name of target user is just name of target user, i.e. "joe". If there's some finer identification of where to write to (name of tty on unix system) and deamon decides to support it, name should have "[terminal_identification%]actual_username" form (terminal_identification must be optional).
This is name of user who asked to write on target user's console. It must be identical with user's login name, as remote side may decide to validate it using ident service. If some kind of network daemon (on local machine) decides to write on someone's console, it should be name of system administrator ("root" on unix systems), so authenticity may be validated by ident service, too.
This line should contain machine-decodable reason why other side wants to print something. In case human just wants to print something (like functionality of write program), subject should be "write". In case some daemon wants to write on user's screen, subject should start with name of daemon. If daemon wants to pass some machine-decodable parameters, name should be followed by TAB character (code \0x09) and list of parameters separated by TABs.
Imagine that user joe@falcor wants to talk with pavel@atrey. After talk daemons connect with each other, talk daemon on atrey should send following lines to write daemon:
pavel root talk(TAB)joe@falcor *** Talk connection requested by joe@falcor.
It would be nice to have standartized subjects (to make machine decoding easier). Here are cases which I can 'look-ahead' and assign them before they are needed. If some server wants to pass some additional information, it may, simply adding TAB and info at the end of the list. But please notify me, so we can assure that all extensions will be done in same way.
In following table, ";" is written where (TAB) is meant - as it is a bit shorter
|Name of service||Assigned subject||Comment|
|write||write||To be used when user talks to writed directly in order to put some message on target's screen|
|talk||talk;fromuser@domain||To be used by standart talk protocol, when talk with target user is requested|
|new mail||newmail;fromuser@domain;subject||This is for tools that inform user about new mail|
|forum||forum;fromuser@domain;subject||Forum is kind of extended talk, it supports 'subject' to be passed with talk request.|
|shutdown||shutdown;time;new_state;reason||This should be used as 'system is going down' announce. Time should be decimal number (in seconds), new_state should be one of halt,singleuser,reboot,crash, reason is not mandatory, it should be explation given by human|
|broadcast||wall||wall is service to write all users on one system, commonly done by command wall|
|panic||panic;severity_level||this will probably be never used (as in time panic is called there's no time to talk to system daemons), but it could be. Severity_level is one of emerg,alert,crit,err,warning,notice,info,debug, for meanings look at man syslog|
If you implement some daemon which needs to print to user's terminal and is not covered here, or if you have some additional arguments to pass, please let me know. Well, in case you start to use this protocol in some of your programs, please let me know. I'm just curious...
Writed sends single line of response code of form X00: followed by explanation in english. X is character, either + (everything OK) or - (some error), or maybe something else, in such case whole line should be ignored. Here is current list of response codes, more may be added later.
Note, that no program should depend on english texts, following english texts are just examples. There are some info in them, but they are intended for humans only.
+01: Accepted, calling user's .ttywrite +02: Accepted, writing on ttyp12 -01: No such user -02: User is not logged in -03: User has messages disabled