






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The commands and authorization matrix for the voting server (vs) protocol. Users can log in, register, and issue commands such as vote, vote-status, poll-totals, and more. The document also includes error codes and examples of command usage.
Typology: Study notes
1 / 12
This page cannot be seen from the preview
Don't miss anything!







Table of Contents
1. Introduction The Voting Server (VS) is a server that allows users to be able vote for a specific item in an active poll. There is a monitor that is able to create polls. A poll is active for a specified amount of time and only registered users or monitors are able to vote in the active poll. To become a register user an anonymous user registers and once the user is registered they become a registered user and can start voting in active polls. Below is an Authorization Matrix that lists which users have access to what commands and the definition of each command. 2. Basic Operation
The server host starts the VS (Voting Server) by listening on an assigned port. When a client wants to connect it establishes a TCP connection with the host. When the connection is established, the VS server sends the version number of the server currently running. From then the client issues commands and the server responds to them. The connection is active until the user issues a QUIT command or the connection is lost.
Messages are sent back and form from the client and server by having the parameter name followed by a semicolon then the data for that parameter followed by a carriage return. A message is terminated by two carriage returns. A carriage return is denoted by โ
Example: command:LOGIN
A value that will be supplied by the client or server is specified as โ
Example: command:LOGIN
Commands in the VS server are uppercase. All data sent is ASCII text and dates are specified as MM-DD-YYYY format.
3. Authorization Matrix List of commands and the users that are allowed to execute the commands. Details about each command are explained in detail in the Commands section.
Anonymous Registered Monitor Admin LOGIN X POLL-STATUS X X X POLL-TOTALS X X X REGISTER X LIST-OPEN X X VOTE X X VOTE-STATUS X X LIST-CLOSED X X ADD-POLL X ADD-MONITOR X QUIT X X X X
In order to become a registered, monitor or admin user you have to send a login command. Upon first connecting to the system you are an anonymous user and only have access rights that an anonymous user has.
command:LOGIN
return-code:<return-code>
Return-code 0-Success 100-Invalid login attempt 125-Server error 127-User already logged in
Example: Client: command:LOGIN
POLL-STATUS Requests the status of the polls/elections, that is if they are open or closed. CLIENT SERVER command:VOTE-STATUS
return-code:<return-code>
Return-code 0 - Success 125 โ Server error
poll-id The unique id identifying this poll label The label describing the poll status open closed
Example: Client: command:VOTE-STATUS
Requests the total for a given poll/election. Anonymous users can only view totals for an active poll. Registered users can view totals for active and closed polls.
Command:POLL-TOTALS
return-code:<return-code>
Return-code 0 - Success 125 โ Server error 130 โ Access denied, not authorized for given poll.
Example: Client: command:VOTE-TOTAL
REGISTER The register command registers an anonymous user. A successful registration requires that the email and nickname be unique in the system. If the registration is successful the users session changes from anonymous user to registered user and has access rights according to the authorization matrix.
command:REGISTER
return-code:<return-code>
Return-code 0 - Success 120- Invalid email 121- Duplicate email 122- Duplicate nickname 125- Server error 126- User not authorized
Example: Client: command:REGISTER
Cast a vote for a particular poll. If the user already voted for the given poll then the new vote replaces the old one.
command:VOTE
return-code:<return-code>
Return-code 0 - Success 125 โ Server error 126 โ User not authorized 144 โ Invalid vote, option does not exist
Example: Client: command:VOTE
Request the vote status for a given poll. That is, if the user has voted in the poll and which option was the vote applied to. If the user voted in a poll then the option is the item the user voted on. If the user did not vote in the given poll then option is blank.
command:VOTE-STATUS
return-code:<return-code>
Return-code 0 - success 125 โ Server error 126 โ user not authorized
Example of a user who has already voted for java:
Client: command:VOTE-STATUS
Example of a user who has not voted:
Client: command:VOTE-STATUS
Requests all the closed polls/elections. Each poll has the following attributes: poll-id (unique), label, description, start-date, end-date and options.
Options contains a comma separated list of items that a user voted on and the total for that item. The format for options is specified below:
command:LIST-CLOSED
return-code:<return-code>
Return-code 0 - Success 125 โ Server error 126 โ User not authorized
Example: Client: command:LIST-CLOSED
Adds a monitor to the system. Only a system administrator can add a monitor to the system. Email and nickname are unique. No two users can be registered having the same email or nickname.
command:ADD-MONITOR
return-code:<return-code>
Return-code 0 - Success 120- Invalid email 121- Duplicate email 122- Duplicate nickname 126- User not authorized
email Email used to login to the system. Maximum length 255 characters.
password Password used to authenticate. Maximum length 24 characters.
nickname Maximum length 20 characters.
Closes the connection.
command:QUIT
Return-code 0 - success 125- server error
An error code of 125 that is Server error means that there was a problem with the server processing the command. If the server uses a database to store the data it could be that the database is down or some other type of error has occurred. In this case it is up to the server administrator to fix this type of errors.
Client: Open tcp connection Server: version:1.0