Technical Information for AnonyNews
Index
Storage
Each message is stored in a separate text file, with the filename based on the date/time. i.e. "YYYYMMDDHHMMSSnnnn" where nnnn is a four digit number to allow for more than one message arriving at the same time. These are assigned by the server at the time it saves the message.
The messages are stored in the "messages" subdirectory of /var/AnonyNews.
Message Format
These details must be taken care of by the Client when it creates the message.
- Line 1: The title of the Message. Must be less than TITLE_SIZE characters, and cannot contain <cr> or <lf>.
- Line 2: The name of the thread. Sent as zero if it is a new thread, and the server will create a thread name equal to the filename. It is of the same format as the filename.
- Line 3: The file name of the parent message. This is set to "0"*FILE_SIZE if there is no parent.
- Lines 4-End: The text of the message. This can contain <cr> and <lf>.
Connection
The client always connects on port PORT_TO_USE (set in anonyboth.h). It must already have a route to the IP address of the server-i.e it will not dial up connections for you.
When sending and receiving data, bear in mind that the software expects a "\n" character to delimit data.
To write a message to the Server
- Attempt to connect to server
- Read value "OK\n" from server
- Send WRITE_MSG (defined in anonyboth.h)
- Read value "OK\n" from server
- Send Title (<TITLE_SIZE characters)
- Read value "OK\n" from server
- Send thread to server (from parent or "0" if it is a new thread)
- Read value "OK\n" from server
- Send filename of Parent message or "0" if it is a new thread
- Read value "OK\n" from server
- Send text of message. The server will continue reading data until the socket is closed
- Close the socket
To Read a Message from the Server
- Attempt to connect to server
- Read value "OK\n" from server
- Send READ_MSG (defined in anonyboth.h)
- Read value "OK\n" from server
- Send Filename to server
- Read Title of message from server (<TITLE_SIZE characters)
- Send "OK\n" to server
- The server will now stream the text and send an EOF when the data is complete.
- Close the socket
To get a list of file headers from the server
- Attempt to connect to server
- Read value "OK\n" from the server
- Send READ_MSG_HEADERS (defined in anonyboth.h)
- The server will now send four text strings
- The filename in which the message is stored
- The Title of the message
- The name of the thread
- The filename of the message's parent ("0" if none)
- After each set of four, the server requires that you send "OK\n" to it
- The server will send EOF by closing the stream after the last OK sent
- Close the socket