Sie sind auf Seite 1von 5

U-Blog Protocol

Message formats
Messages may vary in length. Each message starts with a 1 identifying character field to identify
the message type (the characters are cases sensitive), followed by 0 or more relevant data.
Each part or field of the message is separated from one another by a tab character.
identifying data data ............. data
character

Messages from client


There are seven valid message types. Their format and use is described below:

Login L user id password


8 characters 1016 characters
This message is used to send user ID and password in login command.

View Blog List B


Request
This message is used to request the list of all the available blogs.

View Message M blog id


List Request 6 characters
This message is used to request the list of all comments or messages for a blog id.

Create Blog C blog title ...........


Request 0-40 characters
This message is used to create a new blog with the given title.

Add Message G blog id message..........


Request 6 0-80 characters
characters
This message is used to add a comment or message to the blog with the given id.

Logout O

This message is used to log out.

Messages from server


There are six valid message types. Their format and use is described below:
Positive ACK +

This message is used to acknowledge successful commands


Login
Logout
Add Message Request

Negative ACK error code


2 characters
Error code:
LP: invalid password in Login (L)
LU: invalid user ID in Login (L)
MB: invalid blog id in View Message List (M) request
CB: invalid blog title (duplicate) in Create Blog (C) request
.......
.......

Blog List Z blog-id1 \t title1 \n


Reply blog-id2 \t title2 \n
.................................
.................................
blog-idx \t titlex \n
6 chars 0-40 chars
A variable length list of blogs(blog ids and titles as per blog list file each terminated with \n) in
reply to View Blog List (B) request

Message Y message1 \n
List Reply message2 \n
.................................
.................................
messagey \n
0-80 characters
A variable length list of messages or comments (as per blog message file) each terminated with
\n in reply to View Message List (M) request

Create Blog X Blog code


Reply 6 characters
The reply returns the created blog code in reply to Create Blog (C) request.

Message Sequence Diagram


Client Server
L, user id, password
Login
OK
+

Create C, blog-title
Blog
Assign new
X, blog-id blog id

View Blog B
List
Get all blog info
Z, blog-idi1, blog-title1,
blog-idi2, blog-title2, ...............

Add Message G, blog-id, message


to Blog
OK
+

View Message M, blog-id


List
Get all messages
Y, message1, in the blog
message2, ...............

O
Logout
OK
+

Invalid Login

Client Server
L, user id, password
Login
invalid
-, LP password

L, user id, password


Login
invalid
-, LU user-id

Invalid View Message request

Client Server

View Message M, blog-id


List
invalid
-, MB blog-id

Das könnte Ihnen auch gefallen