| United States-English |
|
|
|
![]() |
hp OpenCall SS7 platform Application Developer's Guide: For Release 3.1 on Linux > Chapter 3 General API GuidelinesScheduling SS7 Connections |
|
Communication is achieved by the asynchronous services offered by an API. When the application requests an API to exchange signaling information via a connection, control is returned to the application until the API returns a response to the request. Application scheduling must only be done in one application main loop, with only one select call in the loop. Each select call loop should take a maximum of 500 milliseconds to process. These asynchronous services of the API are based on the HP OpenCall SS7 scheduling mechanism. This mechanism is based on select(), a system call which allows I/O multiplexing. It contains three phases: These phases must be taken as a block. Keep them together when writing the application. This first phase is used to set up necessary values according to API requirements before the select() call, using SS7_ifselectmask() for MTP, SCCP and OA&M API calls, and TCX_select_mask() for TCAP API calls. SocketsThe HP OpenCall SS7 APIs depend on inter-process communication (IPC) to communicate with the SS7 stack processes. HP OpenCall SS7 uses the Berkeley socket mechanism to exchange signaling information between the application and the HP OpenCall SS7 stack. The API uses file descriptors to access these sockets. MasksBecause file descriptors can also be used by the application, you must provide the API with three file descriptor masks known as the read, write and exception bit masks. Reset all the masks before they are used by the application. These bit masks can be set to include the file descriptors used by the application. Using a preselect function, the SS7 API sets the read, write and exception masks to include the file descriptors managed by the API. The resulting masks are passed to select(). Timeout Valueselect() also uses a shared timeout value. This value is the maximum length of time that a process is allowed to block during a select() if there is no I/0 activity. In the pre-select phase the application must determine a timeout value and submit it to the preselect function. The API assesses its own requirements and may decrease this value to a minimal value such as 500 ms. Because of this make sure to initialize the select() timeout just before the call. FunctionThe pre-select function is mandatory and only modifies the timeout value and bits set by the API in the file descriptor masks, leaving those file descriptors managed by the application untouched. This second phase is the basis of the scheduling mechanism. select() examines the file descriptors specified in the read, write and exception bit masks. When select() is successful, it modifies and returns these bit masks. The respective masks indicate if there is information waiting to be sent (written) or received (read). See the select() man page for details. This third phase analyzes the results of select(), and triggers the necessary processing of the file descriptor bit masks. The API also processes the pending requests to receive and send information via the active connections (file descriptors). During this phase the application can process the bits used by the file descriptors. FunctionThe post-select function manages any information waiting to be exchanged and the internal HA mechanisms. It notifies the application about all the active connections. For HP OpenCall SS7 to maintain the multiple IPC connections to the HP OpenCall SS7 stack(s), the application must be structured around the three scheduling phases. You must do this by using an endless select() loop:
You must always include these three phases, even if you do not want to receive information from a connection. Certain internal API mechanisms require I/O processing without interaction with the application. Scheduling Multiple APIsWhen you are using multiple APIs in the application, you must only have one scheduling loop:
You must set up the pre-select phase for each API involved. Only a single select() can appear in the application. When select() has successfully returned, you must complete the post-scheduling phase for each API involved. |
|||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||