SIP-RS Server

Henning Schulzrinne
Columbia University
New York, NY 10027
USA
hgs@cs.columbia.edu

Yan Xu
Columbia University
New York, NY 10027
USA

Abstract

This report describes the SIP-RS SIP server.

Functions

base64.c

Utility functions that convert to and from base-64 strings, as used in Authorization headers.

config.c

Read server configuration files, where each line is of the form 'parameter: value'.

dstring.c

Dynamic string utility functions.

error.c

Error handling and debugging utility functions.

host2ip.c

Convert host name to IP address.

http.c

Parse generic HTTP headers like Authenticate, Authorization, Content-Length, Content-Type, Date, Server, User-Agent.

invite.c

Handle INVITE request.

locate_user.c

check if the user is currently login or not by calling the lswhod.pl, if the user is currently login, give the machine names. Otherwise, call aliases to find the user login name. If can not find in aliases, call namemapper. Return the result if locating successful, return a null string otherwise.Since the namemapper takes time, send back a 100 message to a client.

mime.c

Handle MIME datatype mapping.

parser.c

Parse RFC822-style requests and responses.

register.c

Handle REGISTER request.

request.c

Requests are stored in an internal data structure so that repeat requests can simply be answered by the current status of the request.
A pointer to the Request struct is created as the head of list of incoming request.
RequestCreate
allocate memory for a request and initilize.
RequestSearch
Search the list of request to check if the request with unique CallID+seqNumber is exist already or not, return true or false accordingly. If the request exist and it is an ACK request, delete the request entry. Otherwise do nothing.
RequestFree
free the given request.
RequestProcess:
Obtain the version, method, protocol, seq number, call ID and other header fields of the SIP request.

response.c

Generate provisional and final SIP responses.

void ResponseInit(void)
Initialize response.
int Response(Request *r, int status, char *reason, DString *location, char *content_type, char *body, int content_length)
Send back the message to a client, including the From, To, Via, Call-ID, Cseq and Location headers. If the user is not found, no Location header will be returned.

sip.c

Parse SIP-specific headers like Call-ID, CSeq, Expires, From, Location, Subject, To, Via.

sip-rs.c

Main program.

strdupn.c

Create duplicate of string, with its own memory.

tcp.c

Handle TCP connections.

udp.c

Handle UDP requests.

uri.c

Parse URIs into their components.

Request Flow

The program starts by reading the configuration file using the routines in config.c.

It then opens a UDP and TCP socket to receive requests. TCP connections are handled by the thread ReceiveTCP, with each new connection obtaining a new thread running ReceiveTCPRequests. UDP requests (unicast or multicast) are handled by the thread ReceiveUDP.

Each request is read and, once completely read, handed to RequestProcess(). That routine parses the SIP-specific headers and then invokes the request-specific function. The ACK request simply sets the ACK flag in the appropriate request. Each INVITE request creates a new thread, while REGISTER requests are handled within the same thread.


Last modified: 1998-07-21 by Henning Schulzrinne