9. Formal Syntax The following is the revised syntax for the Ojects R Us / COP 4331 Server-Client Project: The following syntax specification uses the augmented Backus-Naur Form (BNF) notation as specified in [RFC-822] with one exception; the delimiter used with the "#" construct is a single space (SPACE) and not one or more commas. Some examples: 1*digit can be read as "1 or more digits" "(" #flag ")" can be read as "a parenthesized list of flag objects, with a space and not a comma between objects" 4digit can be read as "exactly 4 digits slash (/) can be read as "or" Here is the Syntax: address ::= string alpha ::= "A" / "B" / "C" / "D" / "E" / "F" / "G" / "H" / "I" / "J" / "K" / "L" / "M" / "N" / "O" / "P" / "Q" / "R" / "S" / "T" / "U" / "V" / "W" / "X" / "Y" / "Z" / "a" / "b" / "c" / "d" / "e" / "f" / "g" / "h" / "i" / "j" / "k" / "l" / "m" / "n" / "o" / "p" / "q" / "r" / "s" / "t" / "u" / "v" / "w" / "x" / "y" / "z" ;; Case-sensitive astring ::= atom / string atom ::= 1*ATOM_CHAR ATOM_CHAR ::= atom_specials ::= "(" / ")" / "{" / SPACE / quoted_specials body ::= string CRLF body/nil CHAR ::= command ::= tag SPACE (command_any / command_auth / command_nonauth / command_select) CRLF ;; Modal based on state command_any ::= "LOGOUT" / "NOOP" ;; Valid in all states command_auth ::= create / delete / examine / list / select / status ;; Valid only in Authenticated or Selected state command_nonauth ::= login ;; Valid only when in Non-Authenticated state command_select ::= "CLOSE" / "EXPUNGE" /fetch / store ;; Valid only when in Selected state continue_req ::= "+" SPACE message_body ;; only time to use this is during fetch of body with many lines CR ::= create ::= "CREATE" SPACE mailbox ;; Use of INBOX gives a NO error CRLF ::= CR LF date_day_fixed ::= 2digit ;; Fixed-format version of date_day date_month_fixed ::= 2digit date_year ::= 4digit date_time ::= <"> date_month_fixed date_day_fixed date_year time<"> delete ::= "DELETE" SPACE mailbox ;; Use of INBOX gives a NO error digit ::= "0" / digit_nz digit_nz ::= "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" examine ::= "EXAMINE" SPACE mailbox fetch ::= "FETCH" SPACE set SPACE ("ALL" / fetch_att / "(" 1#fetch_att ")") fetch_att ::= "HEADER" / "BODY" / "FLAGS" / "UID" flag ::= "\Flagged" / "\Deleted" / "\Seen" flag_list ::= "(" #flag ")" ;; # indicates 1 or more, with space(not comma) between each flag greeting ::= "*" SPACE (resp_cond_auth / resp_cond_bye) CRLF header ::= "(" FROM hd_from SPACE SUBJECT hd_subject SPACE DATETIME hd_date SPACE SIZE hd_size SPACE UID hd_message_id ")" hd_date ::= nstring hd_from ::= address / nil hd_message_id ::= nstring hd_size ::= number hd_subject ::= nstring LF ::= list ::= "LIST" login ::= "LOGIN" SPACE userid SPACE password mailbox ::= "INBOX" / astring / list "INBOX" / list SPACE astring ;; INBOX is case-insensitive. All case variants of ;; INBOX (e.g. "iNbOx") MUST be interpreted as INBOX ;; not as an astring. Refer to section 5.1 for ;; further semantic details of mailbox names. mailbox_data ::= "LIST" SPACE mailbox / "STATUS" SPACE mailbox SPACE "(" # *QUOTED_CHAR <"> QUOTED_CHAR ::= / "\" quoted_specials quoted_specials ::= <"> / "\" response ::= *(continue_req / response_data) response_done ;; 0 or more (continue_req/response_data) followed by response_done response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye / mailbox_data / message_data / mailbox) CRLF response_done ::= response_tagged response_tagged ::= tag SPACE resp_cond_state CRLF respond_cond_auth ::= ("OK") SPACE resp_text resp_cond_bye ::= "BYE" SPACE resp_text resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text ;; Status condition resp_text ::= ["[" resp_text_code "]" SPACE] text ;; text SHOULD NOT begin with "[" or "=" [] = 0 OR 1 OCCURRENCES resp_text_code ::= "ALERT" / "PARSE" / "UIDVALIDITY" SPACE nz_number / "UNSEEN" SPACE nz_number / atom [ SPACE 1*] select ::= "SELECT" SPACE mailbox sequence_num ::= nz_number / "*" ;; * is the largest number in use. For message ;; sequence numbers, it is the number of messages ;; in the mailbox. For unique identifiers, it is ;; the unique identifier of the last message in ;; the mailbox. set ::= sequence_num / (sequence_num ":" sequence_num) / (set "," set) ;; Identifies a set of messages. For message ;; sequence numbers, these are consecutive ;; numbers from 1 to the number of messages in ;; the mailbox ;; Comma delimits individual numbers, colon ;; delimits between two numbers inclusive. ;; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13, ;; 14,15 for a mailbox with 15 messages. SPACE ::= status ::= "STATUS" SPACE mailbox SPACE "(" 1#status_att ")" status_att ::= "MESSAGES" / "UIDNEXT" / "UIDVALIDITY" / "UNSEEN" store ::= "STORE" SPACE set SPACE store_att_flags store_att_flags ::= (["+" / "-"] "FLAGS" SPACE (flag_list / #flag) string ::= quoted / text tag ::= 1* text ::= 1*TEXT_CHAR TEXT_CHAR ::= time ::= 2digit 2digit 2digit ;; Hours minutes seconds uid ::= "UID" SPACE (fetch / store) ;; Unique identifiers used instead of message ;; sequence numbers uniqueid ::= nz_number ;; Strictly ascending userid ::= astring 10. Summary of Commands, Arguments and Repsonses Command Arguments Responses LOGIN Username OK, OK [ALERT] Password NO, NO [ALERT] BAD, BAD[ALERT] LOGOUT OK, OK [ALERT] NO, NO [ALERT] BAD, BAD[ALERT] BYE LIST OK, OK [ALERT] NO, NO [ALERT] BAD, BAD[ALERT] LIST SELECT Mailbox Name OK, OK [ALERT], OK [UNSEEN], OK [UIDVALIDITY] NO, NO [ALERT], NO [UNSEEN], NO [UIDVALIDITY] BAD, BAD[ALERT], BAD [UNSEEN], BAD [UIDVALIDITY] EXISTS CREATE Mailbox Name OK, OK [ALERT], OK [UIDVALIDITY] NO, NO [ALERT], NO [UIDVALIDITY] BAD, BAD[ALERT], BAD [UIDVALIDITY] DELETE Mailbox Name OK, OK [ALERT] NO, NO [ALERT] BAD, BAD[ALERT] STATUS Mailbox Name OK, OK [ALERT] (Status items) NO, NO [ALERT] BAD, BAD[ALERT] STATUS Status items: (MESSAGES UIDNEXT UIDVALIDITY UNSEEN) CLOSE OK, OK [ALERT] NO, NO [ALERT] BAD, BAD[ALERT] EXPUNGE OK, OK [ALERT] NO, NO [ALERT] BAD, BAD[ALERT] EXPUNGE FETCH Message set OK, OK [ALERT], OK [PARSE] (Message items) NO, NO [ALERT], NO [PARSE] BAD, BAD[ALERT], BAD [PARSE] FETCH (FLAGS, HEADER, UID, BODY) Messages items: (ALL FLAGS HEADER UID BODY) STORE Message set OK, OK [ALERT] (Message items) NO, NO [ALERT] BAD, BAD[ALERT] FETCH (FLAGS) Message items: (+FLAGS , -FLAGS , FLAGS ) Flag list: \Deleted \Seen 11. Summary of Command and Response Syntax Commands: SPACE NOOP LOGIN SPACE SPACE LOGOUT LIST SELECT SPACE FETCH SPACE SPACE ( * ALL FLAGS HEADER BODY ) * Note: SPACE in between each item in () if more than one requested. STORE SPACE SPACE +FLAGS -FLAGS FLAGS SPACE ( * \Deleted \Seen ) * Note: SPACE in between each item in () if more than one requested. EXPUNGE CLOSE CREATE SPACE DELETE SPACE STATUS SPACE SPACE ( * MESSAGES UIDNEXT UIDVALIDITY UNSEEN ) * Note: SPACE in between each item in () if more than one requested. EXAMINE SPACE Responses: SPACE OK SPACE SPACE NO SPACE SPACE BAD SPACE * SPACE OK SPACE [ALERT] SPACE SPACE [PARSE] SPACE SPACE [UIDVALIDITY ] SPACE [UNSEEN ] SPACE SPACE NO SPACE [ALERT] SPACE SPACE [PARSE] SPACE SPACE [UIDVALIDITY ] SPACE [UNSEEN ] SPACE SPACE BAD SPACE [ALERT] SPACE SPACE [PARSE] SPACE SPACE [UIDVALIDITY ] SPACE [UNSEEN ] SPACE SPACE BYE SPACE STATUS SPACE SPACE ( * MESSAGES UIDNEXT UIDVALIDITY UNSEEN ) * Note: SPACE in between each item in () if more than one requested. SPACE LIST SPACE SPACE SPACE EXPUNGE SPACE SPACE EXISTS SPACE SPACE FETCH ( FLAGS SPACE ( * \Deleted \Seen \Flagged ) * Note: SPACE in between each item in () if more than one requested. HEADER SPACE (FROM SPACE SPACE SUBJECT SPACE SPACE DATETIME SPACE SPACE SIZE SPACE SPACE UID SPACE ) BODY SPACE CRLF ) + SPACE SPACE FETCH SPACE CRLF End Of Document