CS 596: Client-Server Programming
Spring Semester, 1997
Doc 17, Assignment 3 Comments
To Lecture Notes Index
San Diego State University -- This page last updated Mar 20, 1997
Contents of Doc 17, Assignment 3 Comments
Escaping Special Characters | slide # 2 |
Meta Characters in Grammar | slide # 4 |
Protocol Requirement or Example
Consistency | slide # 5 |
If you have BNF then use it | slide # 6 |
BNF, Structure and Content | slide # 7 |
Specify all parts of the Protocol | slide # 8 |
Positional Data | slide # 10 |
Escaping Special Characters
If you have special characters in your protocol then what
happens if the character appears in text?
Example
Special characters: "{", "=", ";", "}"
- { command=login;
- user=Roger Whitney;
- password=my;pa=ssw}ord
- }
This will be parsed as:
- { command=login;
- user=Roger Whitney;
- password=my;
- pa=ssw
- }
- ord
- }
Some people did not address this problem at all
Some people would talk about some of the special characters,
but forget others
What are the different ways one can address special
characters?
Problem: Meta Characters in Grammar
When the protocol has special characters how does on
indicate this?
So I would see:
The special characters are "{", "=", ";", "}". So an example of a
command is:
- "{" command"="login";"
- user"="Roger Whitney";"
- password"="mypassword
- "}"
Now will the client send the string:
- "{" command"="login";"
- user"="Roger Whitney";"
- password"="mypassword
- "}"
or will it send:
- { command=login;
- user=Roger Whitney;
- password=mypassword
- }
Protocol Requirement or Example Consistency?
If you always give examples like:
- { COMMAND=login;
- USER=Roger Whitney;
- PASSWORD=mypassword
- }
Does that mean the protocol requires the keys be all capital
letters or does it mean you are putting them in all capital
letters so the reader knows they are keys?
If all examples have space around the special characters, is
that part of the protocol or just for readability of the
document?
- { COMMAND = login;
- USER = Roger Whitney;
- PASSWORD = mypassword
- }
If you have BNF then use it!
BNF rules
OCTET = <BLAH>
CHAR = <BLAH>
UPALPHA = <BLAH>
LOALPHA = <BLAH>
ALPHA = <BLAH>
DIGIT = <BLAH>
CTL = <BLAH>
CR = <BLAH>
LF = <BLAH>
SP = <BLAH>
HT = <BLAH>
CRLF = <BLAH>
LWS = <BLAH>
TEXT = <BLAH>
Protocol
{ command=login;
user=string;
password=string
}
What is a string
BNF, Structure and Content
Some BNF Rules
PASSENGER_NAME = *( ALPHA | SP )
TELEPHONE = AREACODE "-" PREFIX "-" SUFFIX |
PREFIX "-" SUFFIX
AREACODE = "(" DIGIT DIGIT DIGIT ")"
PREFIX = DIGIT DIGIT DIGIT
SUFFIX = DIGIT DIGIT DIGIT DIGIT
PLANE_TYPE = "A" | "B" | "C"
FLIGHT_NUMBER = "1201" | "1202" | etc.
MONTH = "Jan" | "Feb" | "Mar" | etc.
Specify all parts of the Protocol
Example 1
departureMonth: month
departureDay: day
departureHour: hour
What is a month - Jan, January, Januar, 1?
What is a an hour - 1:30 pm, 13:30?
Example 2 - Reserving a Seat
Arguments (client):
- - seat
Returns (Server):
confirmation message OK with code
ex: OK Roger Whitney reservation number is: 21de09
The code returned will be of 6 digits and is unique
Example 3 - Tim the Toolman
The cities command will return a labeledTable with column
headers: "City" and "Code"
Example 4
LISTFLIGHT Command
Arguments: optional "FULL", origin city name, destination
city name
Returned Data: simple response: FLIGHT_NUMBER
- full response: FLIGHT_NUMBER, DEPART_TIME,
ARRIVAL_TIME, FLIGHT_TYPE, AVAILABLE_SEAT
Example:
C: LISTFLIGHT, FLAG=FULL, FROM=DFW, TO=LAX
S: LISTFLIGHT, FLIGHT_NUMBER = 302 304 306
S: LISTFLIGHT, DEPART_TIME = 12:30 14:30 19:30
S: LISTFLIGHT, ARRIVAL_TIME = 15:30 17:30 22:30
S: LISTFLIGHT, FLIGHT_TYPE = B C A
S: LISTFLIGHT, AVAILABLE_SEAT = 2 3 4
Elsewhere in the BNF we have:
name-value pair =
- "FLIGHT_NUMBER=" 1*( SPACE flight_number) |
- "DEPART_TIME=" 1*( SPACE time) |
- etc.
flight_number = *digit
Positional Data
RESV date flightNumber
Example:
C: RESV 3,25,1997 108
S: +OK
CITY
Possible Responses:
+OK list of cities follows-
ERR there aren't any cities
Example:
C: CITY
S: +OK 2 cities
S: San Diego, SAN
S: Denver, DEN
S:.