CCL MGCP Protocol Stack Shang-Chih Tsai

Slides:



Advertisements
Similar presentations
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Advertisements

TFTP (Trivial File Transfer Protocol)
Lab tutorial Lab assignment 2 Fall 2006
STUN Date: Speaker: Hui-Hsiung Chung 1.
1 Internet Networking Spring 2006 Tutorial 8 DNS and DHCP as UDP applications.
Sockets Programming CS144 Review Session 1 April 4, 2008 Ben Nham.
UNIX Process Control Bach 7 Operating Systems Course Hebrew University Spring 2007.
Reliable Networking Tom Roeder CS sp. Last minute questions on Part II?
Memory Image of Running Programs Executable file on disk, running program in memory, activation record, C-style and Pascal-style parameter passing.
MInix memory management1 Minix Memory Management. Contiguous memory management. No swapping. A list of holes sorted in memory address order is maintained.
1 Data Communications and Networking Socket Programming Part II: Design of Server Software Reference: Internetworking with TCP/IP, Volume III Client-Server.
The Basics of communication LectureII. Processing Techniques.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
Advanced pointer topics (Reek, Ch. 13) 1CS 3090: Safety Critical Programming in C.
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
02/02/2004CSCI 315 Operating Systems Design1 Threads Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
File Transfer Protocol (FTP)
1 Spring Semester 2009, Dept. of Computer Science, Technion Internet Networking recitation #2 DNS and DHCP.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs) speaker : Wenping Zhang date :
LWIP TCP/IP Stack 김백규.
LWIP TCP/IP Stack 김백규.
ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.
Implementing an extension for freeDiameter
Chapter 4: Interprocess Communication‏ Pages
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
Distributed Systems Concepts and Design Chapter 4.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
Network Programming Eddie Aronovich mail:
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
1 COMP445 Fall 2006 Lab assignment 1. 2 STEP1: Get the name of the second party STEP2: Get phone number from white pages CALLERRECEIVER STEP1: Plug the.
Advanced Sockets API-II Vinayak Jagtap
Cli/Serv.: sockets 3/91 Client/Server Distributed Systems v Objectives –describe iterative clients and servers using the UDP protocol ,
CPS4200 Unix Systems Programming Chapter 2. Programs, Processes and Threads A program is a prepared sequence of instructions to accomplish a defined task.
FTP Server API Implementing the FTP Server Registering FTP Command Callbacks Data and Control Port Close Callbacks Other Server Calls.
Socket Programming Lab 1 1CS Computer Networks.
Remote Procedure Calls CS587x Lecture Department of Computer Science Iowa State University.
Cs423-cotter1 Concurrency Issues in Client/Server Applications Chapters 15,16, 28.
Client/Server Socket Programming Project
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Server-Side C++ Mapping Copyright © ZeroC, Inc. Ice Programming with C++ 6. Server-Side C++ Mapping.
COLONYWIRELESS September 26, Outline 1.Motivation and Goals 2.Introduction to the XBee 3.The Wireless Library 4.Example Packet Group 5.The Token.
ENEE150 – 0102 ANDREW GOFFIN Project 4 & Function Pointers.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
Multi-dimensional Arrays and other Array Oddities Rudra Dutta CSC Spring 2007, Section 001.
UDP : User Datagram Protocol 백 일 우
Environments, Stores, and Interpreters. Overview As we study languages we will build small languages that illustrate language features We will use two.
CSCI  Sequence Containers – store sequences of values ◦ vector ◦ deque ◦ list  Associative Containers – use “keys” to access data rather than.
1 Compiler Construction Run-time Environments,. 2 Run-Time Environments (Chapter 7) Continued: Access to No-local Names.
C Tutorial - Pointers CS 537 – Introduction to Operating Systems.
“Success consists of going from failure to failure without loss of enthusiasm.” Winston Churchill.
Variables Bryce Boe 2012/09/05 CS32, Summer 2012 B.
Speaker :Ying-shun Lin Date:2007/03/26
Chapter 4: Threads.
TFTP Trivial File Transfer Protocol
Introduction of Transport Protocols
Making Virtual Memory Real: The Linux-x86-64 way
Tree A tree is a data structure in which each node is comprised of some data as well as node pointers to child nodes
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Pointers, Dynamic Data, and Reference Types
Govt. Polytechnic,Dhangar
Programming Assignment # 2 – Supplementary Discussion
CSS432 (Link Level Protocols) Reliable Transmission Textbook Ch 2.5
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Operating System Concepts
Programming Language C Language.
Pointers, Dynamic Data, and Reference Types
CCL MGCP Protocol Stack
Presentation transcript:

CCL MGCP Protocol Stack Shang-Chih Tsai

Features of the Stack n The Stack currently supports both Win32 and Solaris platform. n The Stack provides a C language API. n The Stack implemented the "At-Most-Once" functionality (section of RFC 2705). Also, it implemented a retransmission mechanism (section of RFC2705 ) while sending messages with UDP.

MGCP1.0 APIs n mgcMsg : APIs for messages n mgcAck : APIs for acknowledgements n mgcLoop : APIs for waiting incoming messages and sending outgoing messages(or acknowledgments) n mgcSock n mgcHash n mgcStr

Programming Model n Incoming messages mgcLoop Another MGCP process Application Message CCL’s MGCP protocol stack Ack Application process and generate acknowledgement MGCP calls application defined MSG callback function

Initialize mgcLoop int main(int argc, char**argv) { struct mgcExtEvents events[2]; struct timeval timeOut = {60,0}; mgcInit(); events[0].fd = 0; events[0].cb = NULL; /* no user-defined events */ mgcLoopSetDelay(50000); /* initial resend delay = 50 msec */ mgcLoop(2427, doMsg, doAck, events, &timeOut, doTimeout); }

Message Callback Function int doMsg(mgcMsg msg) { /* handle incoming command messages */ switch( mgcMsgGetType(msg) ) { case mgcCreatConn: handleCreatConn(); break; default: break; } mgcMsgFree(msg); /* responsible (could pass on) */ return 0; }

Programming Model n Outgoing messages mgcLoop Application CCL’s MGCP protocol stack Another MGCP process Message Ack External Event Application process and generate MGCP message MGCP calls application defined ACK callback function

mgcSockAddr dst_addr; mgcMsg mgcComm; /* set destination address */ dst_addr = mgcSockAddrNewDom(“gw.ccl.itri.org.tw”, 2427); /* set the MGCP command verb, endpoint and TID */ mgcComm = mgcMsgNew(mgcCreatConn); mgcMsgSetEPt(mgcComm, mgcMsgSetTId(mgcComm,”1007”); / * set command parameters */ mgcMsgAddParm(mgcComm, "C", “1”); /* call ID */ mgcMsgAddParm(mgcComm, "X", ”5”); /* request ID */ mgcMsgAddParm(mgcComm, "L", “P:3-4,A:G.711,B:32-64,E:ON”); mgcMsgAddParm(mgcComm, "M", “SENDRECEV”); mgcMsgAddParm(mgcComm, "S", “RT”); mgcMsgSend(mgcComm, dst_addr); Send Message CRCX 1007 MGCP 1.0 X:5 L:P:3-4,A:G.711,B:32-64,E:ON M:SENDRECV S:RG C:1

Send Acknowledge /* callback function that informing us an incoming MGCP command */ int doMsg(mgcMsg msg) { mgcAck ack = NULL; /* process the command here */ /* send the response to the command */ ack = mgcAckNew(mgcAckOK); mgcAckSetTId(ack, mgcMsgGetTId(msg)); mgcAckAddParm(ack, "I", “ABCDEFGHIJ11” ); mgcAckSend(ack, mgcMsgGetAddr(msg)); … } OK I: ABCDEFGHIJ11

mgcStr struct mgcStrObj { char* text; long len, alloced; }; MGCP_API mgcStr mgcStrNew(void); MGCP_API int mgcStrLen(mgcStr); MGCP_API void mgcStrClr(mgcStr); MGCP_API void mgcStrFree(mgcStr); MGCP_API void mgcStrCat(mgcStr, char*); MGCP_API void mgcStrCatN(mgcStr, char*, int); MGCP_API char*mgcStrAsCStr(mgcStr); mgcStr mgcStrNew() { mgcStr _this; _this = malloc(sizeof *_this); /* ErrorCheck */ _this->len = 0; _this->alloced = MINALLOC; // MINALLOC = 200 _this->text = malloc(MINALLOC); mgcStrClr(_this); return _this; }

mgcHash typedef struct EntryObj *Entry; struct EntryObj { char* key; char* val; Entry next; }; struct mgcHashObj { Entry* table; int CELLS, elements; int keysUpper, strings; Entry iterNext; /* next entry in current bucket */ int bucketNext; /* next bucket to search */ }; table bucketNext /* * CELLs = number of entries in table (may grow) * keysUpper: bool should keys be mapped to upper case * strings: mgcHashType should val be copied (cstrings and ints) * by mgcHashAdd * keys are always strings and always copied */ iterNext Entrys

mgcHash API n MGCP_API mgcHash mgcHashNew(int initSize, int keysUpper, mgcHashType strings); n MGCP_API void mgcHashFree(mgcHash, void (*freeVal)(void*)); n /* add pair key/val to hash, return old value */ MGCP_API void*mgcHashAdd(mgcHash, char* key, void* val); n MGCP_API void*mgcHashDel(mgcHash, char* key); n /* return val for key in hash. NULL if not found. */ MGCP_API void*mgcHashItem(mgcHash, char* key); n MGCP_API voidmgcStartKeys(mgcHash); n MGCP_API char*mgcNextKeys(mgcHash); n MGCP_API int mgcHashSize(mgcHash);

mgcSock struct mgcSockAddrObj { char*domain_; intport_; struct sockaddr_in addr_; mgcSockAddr next_; }; MGCP_API mgcSockAddrmgcSockAddrNewDom(char* domain, int port); MGCP_API mgcSockAddrmgcSockAddrDup(mgcSockAddr); MGCP_API intmgcSockAddrBind(mgcSockAddr, int fd); MGCP_API intmgcSockAddrSendTo(mgcSockAddr, int fd, mgcStr); MGCP_API mgcSockAddrmgcSockAddrRecvFrom(int fd, mgcStr); MGCP_API voidmgcSockAddrFree(mgcSockAddr); MGCP_API char*mgcSockAddrGetDomain(mgcSockAddr); MGCP_API int mgcSockNew(void); freeList

mgcMsg struct mgcMsgObj { mgcMsgTypetype_; mgcStrasStr_; mgcHashparms_; char*tId_; char*ePt_; mgcStrsesParms_; mgcSockAddrsrcAddr_; }; CRCX 1007 MGCP 1.0 X:5 L:P:3-4,A:G.711,B:32-64,E:ON M:SENDRECV S:RG C:1

mgcAck struct mgcAckObj { mgcAckTypetype_; mgcStrasStr_; char*tId_; mgcHashparms_; mgcStrsesParms_; mgcSockAddrsrcAddr_; }; OK I: ABCDEFGHIJ11

mgcLoop n Trace code mgcLoop.c n ackNrecv: outstanding sent messages not yet acknowledged :maps message Tid to the count of messages sent n msgActv: stores active messages received yet to be acknowledged: maps message Tid to a dummy n msgComp1: moves messages from the active list to the completed list maps message Tid to the duplicate acknowledgement to be sent n msgComp2: mirror image of msgComp1 delayed by 30 seconds

mgcAlarm Start Time: ms new HEAP HEAP End Time: ms Start Time: ms Set timer = 5