Implementation of SIP Protocol in Embedded Linux

Due to the limitations of its own resources in embedded systems, it is still difficult to apply the existing SIP protocol directly to embedded portable devices. In order to meet the commercial requirements of the SIP protocol in embedded systems, a simplified SIP protocol stack is designed. First, it analyzes the shortcomings of the SIP protocol when it is directly applied to embedded systems, and then starts with the simplification of the protocol level, rapid response between the levels, and the modular design of the level. It is flexible and extensible, and realizes the embedded transplantation and optimization of SIP protocol code in the embedded Linux system. The test results show that the designed SIP protocol stack occupies a small storage space and runs well under the embedded Linux system platform to meet the design requirements.

The Session Initiation Protocol (SIP Protocol) is an application layer control protocol for multimedia communication in IP networks, which can establish, modify, and terminate multimedia sessions. SIP has good interoperability and openness, supports multiple services and has multimedia negotiation capabilities, and can interact between different devices through SIP servers or other network servers. At the same time, SIP is easy to expand, supports user mobility, and can fully meet the needs of the device for mobile *, and SIP is simple and flexible, and the calculation amount is small, especially suitable for application in embedded application environments. Therefore, the introduction of SIP into embedded applications can effectively improve the interoperability of embedded network devices and the convenience of accessing the network by virtue of the characteristics of SIP itself. However, the SIP protocol itself only provides the grammatical definition of SIP messages and the message processing described by natural language, and does not provide the implementation mechanism of the SIP protocol stack. Here we discuss the establishment of an embedded Linux system on an embedded terminal device, and the completion of SIP embedded, as well as the embedded transplantation and testing of code.

1 Embedded LilIHX system development

1.1 Establish a cross-compilation environment

This article uses the ARMSYS2410-B development board in the laboratory. After preparing the necessary software packages, establishing a cross-compilation environment is actually a cross 2.95.3. tar. The decompression process of bz2. The specific process is as follows:

1) Before compiling Linux, first install cross-compilation toolclhain, create a directory named ann in the / usr / local directory, enter this directory, and perform unpacking:

cd / usr / local / armtar xjvf / mnf / cdrom / linux / toolchain / cross-2.95.3. tar. bz2

2) Edit / etc / profile, find pathmunge / usr / local / sbin, and add a line below it:

Pathmunge / usr / local / arm / 2.95.3 / bin In this way, the kernel or other applications can use arm-linux- to specify the use of the cross compiler.

1.2 Boot Loader transplantation

Boot Loader is a small program that runs before the embedded Linux operating system kernel runs. Through this program, you can copy the kernel from Flash memory to RAM and execute the kernel. It is also necessary to complete the initialization of hardware devices and establish a map of memory space to bring the system's hardware and software environment to a proper state. Use the burning software jflash-s3c2410 to download the Boot Loader binary file to the hardware board through the JTAG port, and download the boot program to the hardware board Flash, so that the Boot Loader can run successfully.

1.3 Recompile the kernel

The kernel downloaded from ***** cannot run directly on the hardware platform. You need to re-cut and compile the kernel according to the specific hardware platform, write the relevant code according to the characteristics of the hardware platform, and port Linux to the platform. The following are modifications to the kernel code: 1) Modify the Makefile under the root of the kernel directory tree to indicate the cross compiler; 2) Configure the Flash partition and modify arch- / arm / mach-s3c2410 / devs. c, to indicate the partition information, the content of the file establishes Nand Flash partition table; modify arch / arm / machs3c2410 / machsmdk241-0. The c file specifies initialization at startup, and the kernel is initially configured according to the partition settings: 3) Configure and compile the kernel. In the Linux source file directory, execute the make menuc-ONfig command to configure the kernel to generate a config file. Then run #make clean; #make dep; #make zImage in turn to complete the compilation of the kernel.

2 Design and implementation of embedded SIP protocol stack

2.1 Realization of SIP protocol stack under embedded

The development of SIP protocol in the embedded environment mainly needs to consider the limitations of the limited resources of the embedded system. According to the characteristics of the system application, the use of system resources such as CPU and storage space must be fully considered in the design. Due to resource constraints, embedded systems are generally used as user terminal equipment, so here the main function of the user agent (UAC / UAS) in the protocol stack is implemented.

The first is the simplification of the protocol stack. According to the SIP protocol stack model defined in RFC3261, SIP is a layered architecture protocol. The protocol is mainly composed of 4 layers, the bottom layer is the syntax codec layer (Syntax & Encoding); the second layer is the transport layer (TransportLayer), which defines how clients and servers on the network receive requests and send responses; the third layer is transactions The layer (TransacTIon) is responsible for transaction processing; the top layer is the transaction user layer (TransacTIon User). Each SIP entity is a transaction user. When a transaction user wants to send a request, a client transaction instance is created to send the request. .

The application of this protocol stack design and implementation method in the embedded environment has the following deficiencies: 1) Too many protocol stack design levels will increase the overhead of the system stack. In order not to occupy too much stack, a larger stack space needs to be allocated when system resources are allocated. The space resources in the embedded environment are limited, and the SIP module occupies too much stack space, which will limit the space allocation of other tasks. 2) Calls between levels will increase the delay of the system and reduce the effectiveness of the system. As user terminal equipment, fast response is an important criterion for design.

2.2 The overall structure of the SIP protocol stack

Based on the above analysis, the SIP protocol stack needs to be modified and tailored in the design so that it takes up as few resources as possible and can achieve maximum response quickly. The embedded SIP protocol stack model designed in this paper is shown in Figure 1.


The protocol stack is mainly divided into a transport layer and a transaction layer. The transport layer is mainly responsible for sending and receiving messages. It manages sockets and network connections, and uses TCP or UDP to transmit data. The transaction layer is responsible for creating and managing transaction objects. Each transaction object is responsible for maintaining state, concurrent messages, and retransmission of messages using the transport layer. The transaction layer also needs to map messages from the transport layer to corresponding transactions.

The SIP protocol stack management layer is responsible for system configuration, allocation of internal management resources, provision of login protocol stack and management commands, and initialization and shutdown of all other layers. Before the application uses the protocol stack, it must first call the initialization interface of this layer to initialize the layer to be used. Before ending the application, it must call the shutdown interface of this layer to close the corresponding layer.

SIP encoding parsing is a time-consuming module in the operation of the protocol stack. To meet the embedded environment, the protocol stack uses a "lazy" parsing strategy. When an original SIP message is received from the network, the message is It is parsed into many "keyword and keyword value pairs". The keyword is the request line or SIP header domain name, and the keyword value is the unresolved request line and header field value. At the transaction layer, the application will only fully parse the request line or a certain header field. This strategy can effectively improve the speed of SIP decoding and greatly improve the applications that need to handle heavy network traffic.

2.3 Implementation of transaction layer and transport layer

Figure 2 shows the software structure of the transaction layer and the transport layer. Both of these two layers use SIP message encoding and parsing layer functions to process SIP messages. The transport layer contains 3 modules: 1) The TcpConn module uses TCP to send and receive messages; 2) The UdpConn module uses UDP to send and receive messages; 3) The SipMessageSendRcv module uses TcpConn and UdpConn to provide a unified messaging interface for applications. In TcpConn and UdpConn, two threads are created to receive and send SIP messages.


The transaction layer creates and manages transaction objects. TransacTIonSendRcv provides an interface for sending different SIP messages, and notifies the application when a message is received in the form of a callback function. Tr-ansacTIonSendRcv uses the send and receive message function provided by SipMessageSendRcv to send and receive SIP messages, and generates events based on the type of messages received and sent. The event and event body (mainly SIP messages) are passed as parameters to the corresponding modules UACTransactFSM and UASTransactlFSM. The core of the transaction layer is these two modules, which respectively represent the processing flow of receiving different messages by the UA client and server. The specific state transition is shown in Figure 3.

Single Voltage AC180-240V  Led Driver


Quick Overview

Constant Current mode output
Typical lifetime>50000 hours
Protections: Short circuit/ Over Voltage/ Over temperature

Single voltage, power 100-130V/180-240V input, plastic shell packaging, for the panel lamp power supply, Suitabled for the European market, indoor  power supply, generally CE TUV UL certification, 3-5years warranty, pay attention to heat problems, to avoid the use of high temperature.


Parameter:

Input voltage:  100-130vac / 180-240vac
output voltage: 25-40vdc / 27-42vdc / 35-45vdc / 50-70vdc 
current: 100mA-2000mA.
Power factor: >0.9
Dimming:Traic
>=50000hours, 3-5 years warranty.
certificate: UL CE FCC TUV SAA ect.




Single Voltage AC180-240V  Led Driver

HZ45W0203


What's the benefits of Fahold Driver?

  • Standard Linear Lighting
  • Cost-effective led driver solution for industry,commercial and other applications
  • Good quality of led driver with high efficiency output to meet different requirements
  • Easy to order and install,requiring less time,reducing packaging waste and complexity
  • Flexible solution



FAQ:
Question 1:Are you a factory or a trading company?
Answer: We are a factory.
Question 2: Payment term?
Answer: 30% TT deposit + 70% TT before shipment,50% TT deposit + 50% LC balance, Flexible payment
can be negotiated.
Question 3:  What's the main business of Fahold?
Answer: Fahold focused on LED controllers and dimmers from 2010. We have 28 engineers who dedicated  themselves to researching and developing LED controlling and dimming system.
Question 4: What Fahold will do if we have problems after receiving your products?
Answer: Our products have been strictly inspected before shipping. Once you receive the products you are not satisfied, please feel free to contact us in time, we  will do our best to solve any of your problems with our  good after-sale service.


Single Voltage AC180-240V Led Driver

Led Driving Lights Driver,60Watt Led Driver,Current Led Driver

ShenZhen Fahold Electronic Limited , https://www.fahold.com