CCL MGCP Protocol Stack

Slides:



Advertisements
Similar presentations
TFTP (Trivial File Transfer Protocol)
Advertisements

STUN Date: Speaker: Hui-Hsiung Chung 1.
1 Internet Networking Spring 2006 Tutorial 8 DNS and DHCP as UDP applications.
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)
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
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 김백규.
ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Network Programming Eddie Aronovich mail:
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Advanced Sockets API-II Vinayak Jagtap
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.
Client/Server Socket Programming Project
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.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
CS307 Operating Systems Threads Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2011.
DMA Driver APIs DMA State Diagram Loading Driver and Opening Channel DMA Channel Attributes Loading Data to a Channel Unloading Data from a Channel.
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
CCL MGCP Protocol Stack Shang-Chih Tsai
C Tutorial - Pointers CS 537 – Introduction to Operating Systems.
“Success consists of going from failure to failure without loss of enthusiasm.” Winston Churchill.
CMSC 421 Spring 2004 Section 0202 Part II: Process Management Chapter 5 Threads.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
Variables Bryce Boe 2012/09/05 CS32, Summer 2012 B.
Message Handling in MFC
Chapter 3 Transport Layer
Functions Students should understand the concept and basic mechanics of the function call/return pattern from CS 1114/2114, but some will not. A function.
Speaker :Ying-shun Lin Date:2007/03/26
Realizing Concurrency using the thread model
5. End-to-end protocols (part 1)
DBW - PHP DBW2017.
Windows Programming Lecture 09.
Chapter 4: Threads.
TFTP Trivial File Transfer Protocol
Magda El Zarki Professor, ICS UC, Irvine
Introduction of Transport Protocols
Mentor Graphics, a Siemen’s Company
Transport Layer Unit 5.
Sarah Diesburg Operating Systems COP 4610
Making Virtual Memory Real: The Linux-x86-64 way
Protocol Basics.
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
Andy Wang Operating Systems COP 4610 / CGS 5765
Realizing Concurrency using the thread model
Programming Language C Language.
Remote invocation (call)
Outline Chapter 3: Processes Chapter 4: Threads So far - Next -
Functions Students should understand the concept and basic mechanics of the function call/return pattern from CS 1114/2114, but some will not. A function.
Pointers, Dynamic Data, and Reference Types
C# Language & .NET Platform 9th Lecture
Presentation transcript:

CCL MGCP Protocol Stack Shang-Chih Tsai Sctsai@itri.org.tw

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

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

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

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: } mgcMsgFree(msg); /* responsible (could pass on) */ return 0;

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

Send Message 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, “20@gw.ccl.itri.org.tw”); 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); CRCX 1007 20@gw.ccl.itri.org.tw 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)); … } 200 1007 OK I: ABCDEFGHIJ11

mgcStr 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); struct mgcStrObj { char* text; long len, alloced; }; 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 struct mgcHashObj { Entry* table; int CELLS, elements; int keysUpper, strings; Entry iterNext; /* next entry in current bucket */ int bucketNext; /* next bucket to search */ }; typedef struct EntryObj *Entry; struct EntryObj { char* key; char* val; Entry next; }; table iterNext /* * 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 */ bucketNext Entrys

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

mgcSock struct mgcSockAddrObj { char* domain_; int port_; struct sockaddr_in addr_; mgcSockAddr next_; }; freeList MGCP_API mgcSockAddr mgcSockAddrNewDom(char* domain, int port); MGCP_API mgcSockAddr mgcSockAddrDup(mgcSockAddr); MGCP_API int mgcSockAddrBind(mgcSockAddr, int fd); MGCP_API int mgcSockAddrSendTo(mgcSockAddr, int fd, mgcStr); MGCP_API mgcSockAddr mgcSockAddrRecvFrom(int fd, mgcStr); MGCP_API void mgcSockAddrFree(mgcSockAddr); MGCP_API char* mgcSockAddrGetDomain(mgcSockAddr); MGCP_API int mgcSockNew(void);

mgcMsg struct mgcMsgObj { mgcMsgType type_; mgcStr asStr_; mgcHash parms_; char* tId_; char* ePt_; mgcStr sesParms_; mgcSockAddr srcAddr_; }; CRCX 1007 20@gw.ccl.itri.org.tw 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 { mgcAckType type_; mgcStr asStr_; char* tId_; mgcHash parms_; mgcStr sesParms_; mgcSockAddr srcAddr_; }; 200 1007 OK I: ABCDEFGHIJ11

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

mgcAlarm Start Time: 12345000 ms HEAP 10 End Time: 12345005 ms 30 20 new 40 70 50 15 HEAP Start Time: 12345005 ms 5 Set timer = 5 25 10 35 65 45 15