Home
TCP/IP - WORLDFIP SUITE Software User Manual
Contents
1. Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_ALLREADYINITIALISED attempts to call more than one sockapi_start function ESOCKAPI_FAMILYNOSUPPORT if the family is not AF_INET or PF_INET used for the Internet protocol ESOCKAPI_TYPENOSUPPORT if the socket type is not SOCK_STREAM for a stream socket or SOCK_DGRAM for a datagram socket ESOCKAPI_PROTOCOLNOSUPPORT 1f the protocol is not supported ESOCKAPI_NOBUE S no more buffers are available ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_ISCONN the socket is already connected ESOCKAPI_INVAL incorrect argument or the socket is already bound ESOCKAPI_FAULT incorrect address length ESOCKAPI_ADDRINUSE the local port is already used by another process ESOCKAP I_CONNREFUSED connection refused by the remote machine ESOCKAPI_TIMEDOUT attempt to connect time out without establishing the connection ESOCKAPTI_OPNOTSUPP the socket type does not support a listen operation ESOCKAPI_NOTBOUND the socket is not bound ESOCKAP I_NOCONREQ the socket is non blocking and no connection requests are present to be accepted ESOCKAPI_NOLISTEN listen Operation was not invoked prior to accept operation ESOCKAPI_INTERNALTCP internal error in the TCP layer ESOCKAP I_NOTCONN the socket is not connected ESOCKAPI_OPFORBIDDEN the operation is forbidden ESO
2. e o gt Y Pr c dente Suivante Dossier parent Adresse Z example hd 63 appli cpp ci root cpp a appli h e3 tcpipmat cpp ic fipmat cpp a tepipmat h a fipmat h ar tcpipos c Co README txt Babies o y 8 appli cpp contains your application e fipmgt cpp e creates an FDM network context e creates the tasks that manage FDM messaging and the IRQ and EOC interrupts of FULLFIP2 O root cpp implements the root task O tcpipos c implements the adaptation to pSOS operating system of the TCP IP Stack module O tcpipmgt cpp e configures the structures for the start of the TCP IP Stack module e creates the tasks that manage the sequencer of the TCP IP Stack module Page 2 10 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual General overview of the software 2 SOFTWARE CONFIGURATION The user has to configure the TCP IP Stack module according to his specific utilisation Modify the TCPIP_Stack Configuration tcpipcfg h file to select the target machine s operating system and define the stack services which have to be activated and set the operating parameters of the various active services for further details see Chapter 3 3 OPERATING SYSTEM ADAPTATION The user has to adapt the following modules to his operating system e TCPIP_Stack e Tools_Box The user has to modify the following files e TCPIP_Stack OS_Adapter tcpipos c e TCPIP_Stack OS_Adapter tcpi
3. for i 0 i lt IP_ADDLEN i fprintf fd d ripfrom i fprintf fd nin close the connection if sock1 gt 0 rv closesocket sock1 if rv 1 error sockapi_get last_error fprintf fd n SO CK1 close socket Error d n error sockl 0 endclient if sock1 gt 0 rv closesocket sock1 if rv 1 error sockapi_get_last_error fprintf fd n SO CK1 close socket Error d n error sockl 0 if sock2 gt 0 rv closesocket sock2 if rv 1 error sockapi_get_last_error fprintf fd An SO CK2 close socket Error d n error sock2 0 if sock3 gt 0 rv closesocket sock3 if rv 1 error sockapi_get_last_error fprintf fd n SO CK3 close socket Error d n error sock3 0 Page A 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Appendix Example of a stream socket server B This example shows how to implement a simple HTTP server that increments a counter each time a browser opens a connection with it static char header HTTP 1 0 200 OK r n Server Embedded 1 0 r n Content Type text html r n r n char response_page lt HTML gt lt BODY gt lt H1 gt Count d lt H1 gt lt BODY gt lt HTML gt static char buffer 512 static counter_page stream_server server_loop HTTP_PO RT void server_loop unsigned short service char Buffer 1024 int msock sso
4. for j 0 j lt 32 j for i 0 i lt 100 msgli j i rv send sock1 msg 100 0 if rv 1 error sockapi_get_last_error fprintf fd n SO CK1 send Error d n error goto endclient rv recv sock1 rcv_buff 100 0 if rv 1 error sockapi_get_last_error fprintf fd in SOCK1 recv Error d n error goto endclient else fprintf fd n ECHO Received message for i 0 i lt 10 i fprintf fd x rcv_bufffi fprintf fd nin Send and Receive on the ECHO socket using sendto and recvfrom functions memcpy char amp to char amp remoteaddr1 sizeof struct sockaddr_in for j 32 j lt 64 j for i 0 i lt 100 msgli j i rv sendto sock1 msg 100 0 struct sockaddr amp to sizeof to if rv 1 error sockapi_get_last_error fprintf fd n SO CK1 send Error d n error goto endclient rv recvfrom sock1 rcv_buff 200 0 struct sockaddr amp from amp fromlen ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page A 5 Example of a stream socket client if rv 1 error sockapi_get_last_error fprintf fd in SOCK1 recv Error d n error goto endclient else memcpy char ripfrom char amp from sin_addr IP_ADDLEN fprintf fd n ECHO Received message for i 0 i lt 10 i fprintf fd x rcv_buff i fprintf fd An FROM remote station
5. ESOCKAPI_NOBUFS In the case of a blocking socket and if the socket is a stream socket the function will block the user thread or process till the buffer contains enough space to copy the message and transmit it ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 19 Software User Manual Socket functions 10 SENDTOQ 10 1 Description The function sendto is normally used to send a message on a datagram socket to a specific peer socket identified by the to parameter see below On a stream socket the parameters to and tolen see below are ignored and sento is equivalent to send When sending data care must be taken not to exceed the maximum buffer sizes of the TCP or UDP layers e stream socket don t exceed the size defined by TCPSBS in TCPIP_Stack Configuration tcpipcfg h O datagram socket don t exceed the size defined by SIZE_OF_LRG BUF 52 in TCPIP_Stack Configuration tcpipcfg h In the case of a datagram socket if no buffer is available within the UDP layer then the function will return 1 and a call of the sockapi_get_last_error function will return ESOCKAPI_NOBUFS This behaviour is available for both a blocking and a non blocking socket In the case of a stream socket if no buffer is available within the TCP layer then for a e blocking socket the function will block till the buffer contains enough space to copy the message and transmit it non blocking socket the function will return 1 and a call to the function
6. ESOCKAPI_PROTOCOLNOSUPPORT if the parameter protocol is not 0 the specified protocol is not supported ESOCKAPI_NOBUFS no more socket descriptors are available the maximum number that can be created is given by MAX_SOCKETS defined in sockapi h 3 5 Performance This function is a non blocking function and is executed in the context of the user thread or process ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 7 Software User Manual Socket functions 4 BINDO 4 1 Description The bind function allows you to associate the freshly created socket identifier to a local endpoint address The local endpoint address comprises the IP address and the port number Function syntax include sockapi h int bind int socket struct sockaddr localaddr int addrlen 4 2 Inputs socket a socket identifier created by the socket function localaddr pointer to a sockaddr structure that specifies the local IP address and the local port number addrlen size of the address structure should be size of sockaddr_in 4 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error 4 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_FAMILYNOSU
7. Page 2 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual General overview of the software 1 3 WorldFIP pseudo device driver module The WorldFIP Pseudo Device Driver module is composed of the following files EX Navigation en cours Z T Mill EG Fichier Edition Affichage A Bom Pr c dente Suivante 5 objet s Ds O source files e fip_ddrv c implements the functions of the WorldFIP pseudo driver O header files e fip_ddrv h O miscellaneous files e user_opt h example of a user_opt h you can modify the user_opt h file from the FDM package as in this example e readme txt text file that provides important information on the options to be set in the tcpipcfg h file of the TCP IP Stack module and the options to be set in the user_opt h file e makefile example of a make file to build the pseudo driver library you should modify this make file file paths etc ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 7 Software User Manual General overview of the software 1 4 Tools Box module The Tools Box module is composed of the following directories Navigation en cours 7 14 BEI EG SUAE e tbx_os c implements semaphores and critical sections if the operating system is not pSOS VxWorks or NT4 then you have to complete this file according to its operating system e tbx_opt h contains the compilation options of the Tools Box module you should m
8. 1 error sockapi_get_last_error fprintf fd n SO CK2 close socket Error d n error sock2 0 TIME CLIENT non blocking client open the socket 3 TIME sock3 socket PF_INET SOCK_STREAM 0 if sock3 1 error sockapi_get_last_error fprintf fd n SO CK3 socket Error d n error goto endclient no bind set as non blocking rv sockapi_ioctl sock3 FIONBIO char 1 if rv 1 error sockapi_get_last_error fprintf fd in SO CK3 ioctl Error d n error goto endclient connect the socket remoteaddr3 sin_family AF_INET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr3 sin_addr unsigned char rip IP_ADDLEN remoteaddr3 sin_port TIME_PO RT rv connect sock3 struct sockaddr amp remoteaddr3 sizeof remoteaddr3 if rv 1 error sockapi_get_last_error fprintf fd in SO CK3 connect Error d n error goto endclient ALS 53425 a en TCP IP WORLDFIP SUITE Page A 3 Software User Manual Example of a stream socket client Receive on the TIME Socket v 1 k 0 while rv 1 rv recv sock3 rcv_buff 100 0 if rv 1 error sockapi_get_last_error if error ESO CKAPI_NODATA if k STAR 0 fprintf fd k else fprintf fd n SOCK3 recv Error d n error goto endclient else fprintf fd Anin TIME for i 0
9. socket PF_INET SOCK_STREAM 0 if sock2 1 error sockapi_get_last_error fprintf fd n SO CK2 socket Error d n error goto endclient localaddr2 sin_family bind to a local endpoint AF_INET localaddr2 sin_addr s_addr INADDR_ANY localaddr2 sin_port 1000 DAYTIME_PORT rv bind sock2 struct sockaddr amp localaddr2 sizeof localaddr2 if rv 1 error sockapi_get_last_error fprintf fd n SO CK2 bind Error d n error goto endclient connect the socket remoteaddr2 sin_family AF_INET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr2 sin_addr unsigned char rip IP_ADDLEN remoteaddr2 sin_port DAYTIME_PORT rv connect sock2 struct sockaddr amp remoteaddr2 if rv 1 sizeof remoteaddr2 error sockapi_get last_error forintf fd n SO C K2 connect Error d n error Page A 2 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Example of a stream socket client goto endclient Receive on the DAYTIME Socket rv recv sock2 rcv_buff 100 0 if rv 1 error sockapi_get_last_error fprintf fd n SO CK2 recv Error d n error goto endclient else rcv_buff rv 0 fprintf fd An DAYTIME fprintf fd s rcv_buff fprintf fd nin close the connection if sock2 gt 0 rv closesocket sock2 if rv
10. This example shows you how to implement a datagram server that echos the received bytes back to the client define DGRAM_SRV_PORT 567 static void datagram_server int srvsock 0 struct sockaddr_insrvaddr struct sockaddr_inclientaddr int clientaddrlen sizeof struct sockaddr _in int error char buffer 1024 int received_bytes int rv Peee DATAG RAM SERVER blocking non connected datagram srvsock socket PF_INET SOCK_DGRAM 0 if sockl 1 error sockapi_get_last_error fprintf fd n SRVSO CK socket Error d n error goto endserver bind to any local endpoint srvaddr sin_family AF_INET srvaddr sin_addr s addr INADDR ANY srvaddr sin_port DGRAM_SRV_PORT rv bind srvsock struct sockaddr amp srvaddr sizeof srvaddr if rv 1 error sockapi_get_last_error fprintf fd n SRVSO CK bind Error d n error goto endserver for receive datagrams on the socket from a Client received_bytes recvfrom srvsock buffer sizeof buffer 0 struct sockaddr amp clientaddr amp clientaddrlen ALS 53425 a en TCP IP WORLDFIP SUITE Page D 1 Software User Manual Example of a datagram socket server if received_bytes 1 error sockapi_get_last_error fprintf fd n SRVSO CK recvfrom Error d n error goto endserver echo back to the Client the received bytes rv sendto srvsock
11. This function is a non blocking function and is executed in the context of the user thread or process Page 8 30 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 16 SOCKAPI_DOT2IP 16 1 Description This function converts the string pdot representing the IP address in dotted decimal form into an IPaddr address Function syntax include sockapi h void sockapi_dot2ip IPAddr ip char pdot 16 2 Inputs ip IP address filled by sockapi_dot2ip pdot the string to be converted containing the IP address in dotted decimal form 16 3 Performance This function is a non blocking function executed in the context of the user thread or process ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 31 Software User Manual Socket functions Page 8 32 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter TCP IP Stack module functions 9 1 TCPIP_GETADDRO O REQUESTING THE IP ADDRESS OF A LOCAL INTERFACE 1 1 Description If the point to point IP address of an interface is not known the user can request this address using the tcpip getaddr function In this case a RARP server must be present on the remote machine The invocation of the tecpip_getaddr function should be performed after calling the tcpip_start function the RARP mechanism will be initiated Function syntax include sockapi h tcpip_getaddr unsigned short if_number IPaddr ip_addr 1 2 Input p
12. in bytes define IP_VERSION 4 current version value define IP_MINHLEN 5 minimum IP address header length in longs 6 define IP_TTL 1 initial Time To Live value define RT_MAX 50 max number of routes define RT_UPDATE 100 period of sweep of the routing table to decrement time to live values and dispose of routes that have expired measured in timer ticks used only if RIP protocol is implemented define GW_DEFAULT 192 9 230 3 default gateway define IP_DEFAULT 1 default interface to reach the default gateway define DT_DEFAULT 1 distance in hops define FG_UPDATE 100 period of check of the fragment lists measured in timer ticks define IP_FTTL 600 time to live of reassembly of fragments measured in timer ticks if after IP_FTTL ticks we don t have all the the fragments then send an ICMP time exceed Figure 3 6 IP Protocol Configuration Parameters Page 3 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software configuration 7 ARPPROTOCOL CONFIGURATION PARAMETERS ARP protocol configuration parameters define ARP_TSIZE 50 max ARP cache size for each interface define ARP_OSIZE 10 ARP queue size for the packets waiting ARP resolution for an address define ARP_RESEND 10 resend a ARP packet if no reply measured in timer ticks define RARP_RESEND 15 resend a RARP packet if no reply measured in ti
13. le return s ALS 53425 a en TCP IP WORLDFIP SUITE Page B 3 Software User Manual Example of a stream socket server Page B 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Appendix Example of a datagram socket client C This example opens three clients e on socket 1 a non blocking and non connected ECHO client 1 e on socket 2 a blocking ECHO client 2 connected with bind e on socket 3 a blocking ECHO client 3 connected without bind static void datagram_clients int sockl 0 int sock2 0 int sock3 0 struct sockaddr_inlocaladdr1 localaddr2 localaddr3 struct sockaddr_inremoteaddr1 remoteaddr2 remoteaddr3 struct sockaddr_infrom Ipaddr rip ripfrom int fromlen sizeof struct sockaddr_in int error char msg 300 char rcv_buff 310 int rv int i j k Pee ECHO CLIENT 1 non blocking non connected datagram sock1 socket PF_INET SOCK_DGRAM 0 if sockl 1 error sockapi_get_last_error fprintf fd in SO CK1 socket Error d n error goto endclient setas non blocking rv sockapi_ioctl sock1 FIONBIO char 1 if rv 1 error sockapi_get_last_error fprintf fd in SO CK1 ioctl Error d n error goto endclient bind to any local endpoint localaddr1 sin_family AF_INET ALS 53425 a en TCP IP WORLDFIP SUITE Page C 1 Software User Manual Example of a datagram socket client localaddr
14. 1 3 Outputs 0 gt OK 1 gt error Page 6 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation 2 2 DEV_WRITEO sending packets 2 2 1 Description The TCP IP Stack module calls the function to send message packets DEV_WRITE is implemented in the form of an empty function in the TPIP_Stack Device_Driver_Adapter tcpipdrv c file The user writes the body of this function and carries out the appropriate call to its operating system for example write Function syntax include tcpip h DEV_WRITE IF_DEV_TYPE dev void xmit_buff unsigned nbytes 2 2 2 Inputs dev number of the device driver if necessary the user has to set IF_DEV_TYPE in the TCPIP_Stack Device_Driver_Adapter tcpipdrv h file the user gets this number when the device driver is opened xmit_buff pointer to a structure whose type depends on the interface type WorldFIP or Ethernet IF driver WorldFIP THEN xmit_buff is a pointer to a FIP_PACK structure defined below ELSE IF driver Ethernet THEN xmit_buff is a pointer to a structure FIP_PACK defined below nbytes size of the message packet to be sent 1 In the case of an Ethernet WorldFIP router the type of the interface will be found according to the number of the device driver dev You can use global variables for the open devices and then perform processing according to the number of devices whose parameters are set in the D
15. 53425 a en 4 4 Returned values TCPAP Stack module functions Value Description 0 OK 1 if the requested interface is not initialised then it needs to be correctly initialised by the tcpip start function 2 1f there is a system error ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 9 9 TCP IP Stack module functions 5 TCPIP_RTDEL DELETING AN ELEMENT FROM THE ROUTING TABLE 5 1 Description Deletion of a route element added by tcpip_rtadd from the routing table is performed by the user through invocation of the tecpip_rtdel function Function syntax include sockapi h tcpip_rtdel IPaddr rt_net IPaddr rt_mask 5 2 Input parameters rt_net IP address that must contain the network address for this route rt_mask IP address that must contain the mask for this route 5 3 Output parameters None 5 4 Returned values Value Description 0 OK 1 if the requested interface is not initialised then it needs to be correctly initialised by the tcpip_start function 2 if there is a system error Page 9 10 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCPAP Stack module functions 6 TCPIP_ECHO_RQ O SENDING AN ECHO REQUEST 6 1 Description To test whether a device is present the user can query it by invoking the tcp_echo_rq function This call addresses the ICMP layer inside the TCP IP Stack module which build
16. In the case of a non blocking socket the behaviour of the function is described by the recv function In the case of a blocking socket the function will block the user thread or process See recv function for the unblocking conditions ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 27 Software User Manual Socket functions 13 CLOSESOCKET 13 1 Description An application calls the closesocket function after it has finished using a socket The closesocket function frees the resources associated with the socket In the case of a stream socket the function closesocket initiates the graceful close sequence This sequence 1s completed when the remote application also closes the connection Any unread data waiting at the socket will be discarded Function syntax include sockapi h int closesocket int socket 13 2 Inputs socket a socket identifier created by the socket function 13 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error 13 4 Fault messages The returning values of the function sockapi_get_last_error are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling a sockapi_start function ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_INTERNALTCP internal error in the TCP layer 13 5 Performance In the case of a stream socket the function will block th
17. Manual Device driver adaptation ep ETH_PACK tbx_AllocateBufferlnPool N et eth_pool iffep 0 fprintf fd n ERROR Pool eth_pool n return pip struct ip ep gt eth_packet data call your ETHERNET device driver read function IF the received data is for yourself or a broadcast packet THEN copy the received data in the memory pointed by ep ELSE ignore the received frame and free ep by the function tox_FreeBufferlnPool TBX_USER_BUFFER ep ENDIF call the function tcpip_rcvpack tcpip_rcvpack eth_if_no void ep unsigned EP_HLEN pip gt ip_len Page 6 18 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Chapter Software startup and stoppage 1 TCIP_START O STARTUP PROCEDURE OF THE TCP IP STACK MODULE 1 1 Description The initialisation and start up of the TCP IP Stack module will be carried out by calling the tcpip_start function The user must complete some structures that contain the parameters of each network interface Syntax include tcpip h tcpip_start TBX_MEMORY_RN tcpip_memory IF_FIP if_fip IF_ETH if_eth SIGNALS_ADDR signals_addr ICMP_RESP_ADDR icmp_resp_addr 1 2 Inputs tcpip_memory pointer to a structure of the TBX_MEMORY_RN type defined in the Tools_Box Tools tbx h file that allows you to define a memory region if the operating system permits this where will be allocated all the resou
18. Stack module carries out the following control operations on a device driver O jnitialises the resources and elements required for driver messaging run only once at TCP IP Stack start up O requests freeing of all pseudo driver resources run only once at complete stop of the TCP IP Stack 0 requests freeing of a pseudo driver receive resource run after each incoming message this operation is available only in the case of a WorldFIP interface when the option in the FIP_DRV_IND TCPIP_Stack Configuration tcpipcfg h file is set to TCPIP_YES The TCP IP Stack carries out a call of the DEV_CONTROL function which is implemented in the form of an empty function in the TCPIP_Stack Device_Driver_Adapter tcpipdrv c file The user writes the body of this function and carries out the adequate call of its operating system for example ioctl Function syntax 5 include tcpip DEV_CONTROL IF_DEV_TYPE dev int ctrl void args 2 1 2 Inputs dev number of the device driver if necessary you have to set IF_DEV_TYPE in the TCPIP_Stack Device_Driver_Adapter tcpipdrv h file the user gets this number when the device driver is being opened ctrl command number INIT_DEV initialises the resources and elements required for driver messaging run only once at TCP IP Stack start up STOP_DEV requests freeing of all pseudo driver resources run only once at complete stop of the TCP IP Stack FREE_MEM_DEV requests fr
19. addr_user_signal_fip fatal _error unsigned long int void addr_user_signal_fip_warning unsigned long int TBX_MEMORY_RN memory unsigned long if_report FIP_MSG_INIT Figure 6 2 FIP_MSG_INIT structure Page 6 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation Software element Description protocol upper protocol mapped on the driver for instance only TCP IP 1 gt protocol TCPIP if number interface number transmitted by the TCP IP Stack module this number has to be memorised by the device driver because the device driver will use this number as a parameter when it will call the function tcpip_rcvpack fip pool not used nb_of_lsaps number of LSAPS generally 2 LSAPS one for the point to point address and one for the broadcast address lsap_desc_table pointer to an array of nb_of_1saps pointers to structures of the LSAP_DESC type defined below msg_type messaging type 0 in the case of aperiodical messaging in the case of periodical messaging channel _nr channel number 0 in the case of aperiodical messaging to 8 in the case of periodical messaging identifier identifier of the produced variable in the case of periodical messaging should be set to 0 in the case of aperiodical messaging fdm_ref pointer that is cast to a structure of the FDM_REF type defined in the User Manual of FIP DEV
20. define HTTP_PO RT 80 int error FILE fd stderr launch the TCP IP suite rv tcpip_start 0 0 amp if_eth amp signals addr amp icmp_resp_addr if rv O fprintf fd n tcpip_start Error d n rv launch the SockAPI library if sockapi_start 0 0 error sockapi_get_last_error fprintf fd An sockapi_start Error d n error strea m_clients example of stream clients strea m_server example of stream server datagram_clients example of datagram clients datagram_server example of datagram server stop the SockAPI library sockapi_stop stop the TCP IP suite tcpip_stop ALS 53425 a en TCP IP WORLDFIP SUITE Page A 1 Software User Manual Example of a stream socket client This example of a stream socket client opens 3 clients e on socket 1 a blocking ECHO client e on socket 2 a blocking DAYTIME client e on socket 3 a non blocking TIME client static void stream_clients int int int sockl 0 sock2 0 sock3 0 struct sockaddr_inlocaladdr1 localaddr2 localaddr3 struct sockaddr_inremoteaddr1 remoteaddr2 remoteaddr3 struct sockaddr _into from IPaddr int int char char int int rip ripfrom fromlen sizeof struct sockaddr_in error msg 300 rcv_buff 310 rv i j pore DAYTIME CLIENT blocking client open the socket 2 DAYTIME sock2
21. eth_dev_fd sockapi_dot2ip eth_general if_ip_addr IP_ST1_ETH set the WorldFIP pseudo drivers handles fip1_dev_fd 1 fip2_dev_fd 2 set the fields if_ dev et if_ip addr of fip_generall and fip_generall structures fip_general1 if_ dev IF_DEV_TYPE fip1_dev_fd sockapi_dot2ip fip_generall if_ip addr IP_ST1_FIP1 fip_general2 if_dev IF_DEV_TYPE fip2_dev_fd sockapi_dot2ip fip_general2 if_ip addr IP_ST1_FIP2 initialise the FULLFIP2 components of the 2 WorldFIP interfaces using fdm_initialize_network function of FDM FULLFIP1 fdm_initialize_network Page 7 12 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage FULLFIP2 fdm_initialize_network fip_if_param1 fdm_ref FULLFIP1 fip_if_param2 fdm_ref FULLFIP2 rv tcpip_start 0 amp if_fip amp if_eth amp signals addr amp icmp_resp_addr if rv 0 printf n tcpip_start Error d n rv tcpip_stop else get and memorise the interface numbers these numbers are set by the TCPIP Stack module and will be used by some TC PIP Stack module functions eth_if_no eth_general if number fip1_if_no fip_general1 if_ number fip2_if_no fip_general2 if_ number ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 13 Software User Manual Software startup and stoppage 2 SOCKAPI_START STARTUP PROCEDURE OF THE SOCKAPI MODULE 2 1 De
22. i lt rv i fprintf fd x rev_buff i fprintf fd nin close the connection if sock3 gt 0 rv closesocket sock3 if rv 1 error sockapi_get_last_error fprintf fd n SO CK3 close socket Error d n error sock3 0 ECHO CLIENT blocking client open the socket 1 ECHO sock1 socket PF_INET SOCK_STREAM 0 if sockl 1 error sockapi_get_last_error fprintf fd in SO CK1 socket Error d n error goto endclient bind to any local endpoint localaddr1 sin_family AF_INET localaddri sin_addr s_ addr INADDR ANY localaddr1 sin_port 0 any port rv bind sock1 struct sockaddr amp localaddr1 sizeof localaddr1 if rv 1 error sockapi_get_last_error fprintf fd in SOCK1 bind Error d n error goto endclient Page A 4 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Example of a stream socket client connect the socket remoteaddr1 sin_family AF_INET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr1 sin_addr unsigned char rip IP_ADDLEN remoteaddr1 sin_port ECHO _PORT rv connect sock1 struct sockaddr amp remoteaddr1 sizeof remoteaddr1 if rv 1 error sockapi_get_last_error fprintf fd in SOCK1 connect Error d n error goto endclient Send and Receive on the ECHO socket using send and recv functions
23. its da 8 25 11 5 Performance rt ira iia 8 25 12 RECVEROMO cion sd ad Be a atte Bakes 8 26 12 17 Description 8 26 12 2 PU ii GOA E he ei eis Baie ie Ca oes 8 26 1233 TT 8 27 124 Fault messages x scis2 sssssscessess sou asds ease stan iechsste ines stescssyss E E EEE EE denied tesis its 8 27 12 5 Performance 2 22 sscesses celeste ssc ceca o EEEE ESE T S E E chee svensaus TEE E FESE sapessenpeed deepsea TESE 8 27 13 CEOSESOCKE TO mra a A iia 8 28 13 1 DESCTIP ION ao tintes a E e aroi neos 8 28 132 inputs eneren n E a A T iii 8 28 3 3 OUtPUtS i s e EE E EEE E aie OE EEE E di Mia ina E 8 28 13 4 A NN 8 28 13 5 Performance ad 8 28 14 SOCKAPI GET_LAST_ERRORO ereitera e rriar EEEE EE EEEE EEEE T EE chee ii 8 29 14 1 D Sei m Din OS n POES S ERE AEEA ETES 8 29 O A roer eT Er EE E EEE E E ain Bee E aie 8 29 14 3 Performance msi o titi 8 29 152 SOCKAPITP2DO TO icons e id ibi 8 30 152 Descriptor Ao ic 8 30 IZ tastes soit specestivek adoesates E EE E EEEE cpus EEEE EEEE E EE ESEE E E cele 8 30 15 3 Performanc s nosine neea ron o no E E E E Ni aL E AML O EERS 8 30 T6 SOCKAPL DOTA O iii end 8 31 16 1 Description eine a eee 8 31 10 2 Eo ET dial 8 31 16 3 NO 8 31 Page 12 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Contents CHAPTER 9 TCP IP STACK MODULE FUNCTIONS 1 W A TCPIP_GETADDR REQUESTING THE IP ADDRESS OF A LOCAL INTERFACE 9 1 1 1 Descrip eto rE r EEE E og chess EE A E E O E E r
24. lsap_no array of 3 bytes that contains the LSAP number nb_of_rec_buf number of buffers that should be allocated for the reception of message packets for this LSAP number 2 1 2 3 Description of the ETH_MSG_INIT structure typedef struct unsigned short if_ number ETH SPECIFIC eth_ specific void indication unsigned short void unsigned TBX_MEMORY_RN memory unsigned long if_report JETH_MSG_INIT if_number interface number transmitted by the TCP IP Stack module this number has to be memorised by the device driver because the device driver will use this number as a parameter when it calls the tcpip rcvpack function eth_specific structure of the ETH_SPECIFIC type see Chapter 7 indication address of a callback function that should be called whenever a message packet is received this field is set by the TCP IP Stack module as the address of the function tcpip_revpack memory pointer to a structure of the TBX_MEMORY_RN type defined in the Tools_Box Tools tbx h file that allows you to define a memory region if the operating system permits this where will be allocated all the resources for this interface if the operating system doesn t allow you to define a memory region then this parameter should be set to 0 if_ report return value of interface initialisation this field is set by the device driver The user has set most of the above parameters when he calls the tcpip_start function 2
25. n tcpip_conf_tarp Error d n rv ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 7 Software User Manual TCP IP Stack module functions 4 TCPIP_RTADDQ ADDING AN ELEMENT TO THE ROUTING TABLE 4 1 Description If the user has implemented protocols such as RIP or OSPF above the TCPIP stack module then he can add a route element to the routing table by invoking the tcpip_ rtadd function Otherwise the user must invoke this function only if he is certain of the data being entered Function syntax include sockapi h tcpip_rtadd IPaddr rt_net IPaddr rt_mask IPaddr rt_gw int rt_metric unsigned short rt_ifnum int rt ttl 4 2 Input parameters rt_net IP address that must contain the network address for this route rt_mask address that must contain the mask for this route rt_gw IP address that must contain the IP address of the next hop rt_metric distance expressed as a number of hops rt_ifnum interface number to which the message is transmitted rt_ttl time in seconds required to validate the existence of the route element in the routing table when this field reaches the value O this element is removed from the table The user can set an infinite time for this element RT_INF value defined in the TCPIP_Stack Basic_Stack route h file thus rendering this element permanent 4 3 Output parameters None Page 9 8 TCP IP WORLDFIP SUITE Software User Manual ALS
26. ocococcccoccconcnoncnnncnnncnoconoconccnnonononnnonn nro conc nnnncnecnnos 3 4 7 ARP PROTOCOL CONFIGURATION PARAMETERS ocooococcconcnnncnnnconononnnnnonnnnnnnc nono noconccnnconnccnncnnninnos 3 5 8 ICMP PROTOCOL CONFIGURATION PARAMETERS cccocconcccoccconoconoconocnnocnnonononnncnncronnnnonnncnnncnnncnnos 3 5 9 UDP PROTOCOL CONFIGURATION PARAMETERS c ooooooccccccccnconnconoconoconoconocnnonnnonnnonnnrnn cnn nnnccnnccones 3 5 10 TCP PROTOCOL CONFIGURATION PARAMETERS cococococccononnnonnncononononnnnnnncnnnconoconeco nono nooo ncrnncnnninnos 3 6 1 1 ALLOCATED RAM MEMOR Ya esses rennene ee iea apa a dees riera 3 7 11 1 RAM memory allocated by the TCP IP Stack module ooooonncnnnnnnononoccnnncnonnnnnconoconoconocn nooo nornnonnninnos 3 7 11 2 RAM memory allocated by the WorldFIP pseudo driver oooconncnnccnoccconoconoconccononononnnonnninncnancnnncnnnos 3 8 ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 9 Contents CHAPTER 4 OPERATING SYSTEM ADAPTATION 1 ADAPTATION OF THE TCPIP_STACK MODULE eaor terei eoio sroti epiese bner Eres oki EREET EESE SEE 4 1 2 ADAPTATION OF THE TOOLS BOX MODULE coococccnccnoccnonoconocnnonnncnnoconoconocnnonnnonnncnnnrnn non cano rnncnnnono 4 2 CHAPTER 5 TCP IP SEQUENCER ls MODULE DESCRIPTION iu 5 1 2 EXAMPLES ooo ab isa 5 3 2 1 Example of a sequencer in a multi task context oooooocnncnnccnocnnonnonnconoconoconocono cono rn nono nonn cnn nono rnnn cn nccnnono 5 3 2 2 Example of a
27. of the error is provided in the if_report field of the FIP_IF_PARAM structure the user should check all of these structures to find the faulty device if there is an initialisation problem for at least one Ethernet device driver a detailed description of the error is provided in the if_report field of the ETH_IF_PARAM structure the user should check all of these structures to find the faulty device if there is an initialisation problem of the critical region in the Tools Box module ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 7 Software User Manual Software startup and stoppage 1 4 Example Let us suppose that there are 1 Ethernet interface and 2 ALSTOM WorldFIP interfaces define ETH_ADDR_BRC Oxff Oxff Oxff Oxff Oxff Oxff hardware broadcast address define ETH_ADDR_ST1 0x8 0 0x20 Ox1f 0x44 0x67 hardware pointto point address define IP_ST1_ETH 192 9 230 1 IP address static ETH_SPECIFIC eth_specific ETH_ADDR ST1 ETH ADDR BRC NB_OF_ETH_BUF SIZE_OF_ETH_BUF le static GENERAL eth_general eth1 if name 0 if no is set by the TCPIP Stack module 0 0 0 0 IP addr set by calling sockapi_dot2ip 0 broadcast type specify the host value of an IP address 0 aperiodical 1 periodical MAX_ETH_MTU Maximum Transmit Unit 0 device number 0 arp policy 0 gt permanent entries in ARP table 1 gt the A
28. sequencer in a mono task CONtOXt ooonnnonnnocnconcnoncnononnnonnnonn conc conc nnnncnnn cono cn nero nccnnccn corno 5 5 CHAPTER 6 DEVICE DRIVER ADAPTATION COMERME e le an 6 1 Ze PUNCHONS 0 e ok td a Ade dos do ol 6 3 2 1 DEV_CONTROLO control Operations a kornean a iea a aniei eike atea niini 6 3 2 1 1 DESCTIPUOM eiee e conve a E nev TAE E a E R e iaia EE E E AO 6 3 2 1 2 Inputs 2 1 2 1 Description of the FIP_MSG_INIT structure ccccesceessssceseeseeseceeceseeseeseeseceeeaeeseesecaeceaeesecaesaeeaeeaeeaeseseeeeaeeaeeaeente 2 1 2 2 Description of the LSAP DESC structure 0 ccecessesseeseeseeseeseeseesecceesecsecsecsecseeeaeesecsecaeeeeeaeeaeeseeaeeaecaeeeaeeaeeaeeaeente 2 1 2 3 Description of the ETH_MSG_INIT structure woth 2 1 3 A E sue upsed essodessedeesaiodde vagsases bassesdevasesdea bayencdevenense 2 2 DEV_WRITEO sending packets cesssccossssssscnsetssscconssessscsoseesssscsensessscsonsesdasesonesessssosser snes 2 2 1 DES A AA AS dates tional anole eae da ences 2 2 2 PUES E FE AA A 2 2 3 UU a a esas 23 TEPIB RCOVPACKO TECELVINE packets cid E 2 3 1 Description aa 2 3 2 PUES EA E E EEEE EE AE E E EEEE 2 3 3 O NN 2 4 Examples nar ete 2 4 1 Interfacing an Ethernet rivers csc seeccecesthestdatedeseseevscst cedehesceesuecess Coa EEEE a e EEE a ri e 2 4 2 Interfacing an Ethernet and two ALSTOM WorldFIP pseudo driVelS ooconcnncnnoninnnnnonnnnnonononocancnn cancion 6 16 CHAPTER 7 SOFTWARE START
29. src bytes 6 hight type eth_rcv_pk type 0 low_type eth_rcv_pk type 1 type hight_type lt lt 8 type type low_type ep gt eth_packet eth_header type type pip struct ip ep gt eth_packet data accept the frames for yourself or the broadcast frames if bIlkequ ep gt eth_packet eth_header dst localaddr bytes 6 TCPIP_TRUE blkequ ep gt eth_packet eth_header dst eth_addr_brc 6 TCPIP_TRUE call the function tcpip_rcvpack tcpip_rcvpack eth_if_no void ep unsigned EP_HLEN pip gt ip_len ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 15 Software User Manual Device driver adaptation 2 4 2 Interfacing an Ethernet and two ALSTOM WorldFIP pseudo drivers This example shows how to find the interface type in the case of simultaneous use of Ethernet and ALSTOM WorldFIP interfaces Let us suppose that there are 1 Ethernet interface and 2 ALSTOM WorldFIP interfaces You have to create the eth_rcv_pack function and call it periodically include tcpip h global variables declared in the file that initialises the TC PIP stack module see the example of how to initialise the TCP IP Stack extern IF_DEV_TYPE eth_dev_fd extern IF_DEV_TYPE fip1_dev_fd extern IF_DEV_TYPE fip2_dev_fd unsigned short eth_if_no DEV_CONTROL IF_DEV_TYPE dev int ctrl void args ETH_MSG_INIT eth_msg_init if dev eth_dev_fd ETHERNET dri
30. the function sockapi_get_last_error will return ESOCKAPI_MSGSIZE e the TCP reception buffer has received a message then the size of delivered bytes to the user is as great as currently available up to the size of length bytes ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 23 Software User Manual Socket functions e if buffered delivery is set and e if the number of received bytes in the TCP reception buffer contains less than length bytes then the function will return 1 A call to the sockapi_get_last_error function will return ESOCKAPI_NODATA e ifthe number of received bytes in the TCP reception buffer contains at least length bytes then the size of delivered bytes to the user is length bytes However if the data has arrived with the PUSH bit set see TCP header then the data will be delivered immediately and the size of the delivered bytes to the user is as great as currently available up to the size of length bytes The default settings for a created socket are blocking socket and unbuffered delivery these settings can be changed by a sockapi_ioctl function Datagram sockets In the case of a datagram socket data is extracted from the received datagram up to the size of the buffer supplied If the datagram is larger than the buffer supplied the buffer is filled with the first part of the datagram the excess data is lost and recv returns 1 A call to the function sockapi_get_last_error will return ESOCKAPI_MSGSIZE e Dat
31. 1 sin_addr s_addr INADDR_ANY localaddr1 sin_port 0 any port rv bind sock1 struct sockaddr amp localaddr1 sizeof localaddr1 if rv 1 error sockapi_get_last_error fprintf fd n SOCK1 bind Error d n error goto endclient remoteaddr1 sin_family AF_IN ET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr1 sin_addr unsigned char rip IP_ADDLEN remoteaddr1 sin_port ECHO _PORT Send and Receive for j 0 j lt 16 j for i 0 i lt 100 msgli j i rv sendto sock1 msg 100 0 struct sockaddr amp remoteaddr1 sizeof remoteaddr1 if rv 1 error sockapi_get_last_error fprintf fd An SO CK1 send Error d n error goto endclient ve l k 0 while rv 1 rv recvfrom sock1 rcv_buff 200 0 struct sockaddr amp from amp fromlen if rv 1 error sockapi_get_last_error if error ESO CKAPI_NODATA if k STAR 0 fprintf fd k else fprintf fd in SOCK1 recv Error d n error goto endclient else memcpy char ripfrom char amp from sin_addr IP_ADDLEN fprintf fd n ECHO Received message for i 0 i lt 10 i fprintf fd x rcv_buff i fprintf fd n FRO M remote station for i 0 i lt IP_ADDLEN i fprintf fd d ripfrom i fprintf fd Ann close the connection Page C 2 TCP IP WORLDFIP SUITE Softwa
32. 6 2 Inp tpa rameterS nia ea aE E a iii fusta 9 11 6 3 Output parameters lia 9 12 6 4 Returned ISA ree Tarer r re EEE EA Tr E EEr EE EEE Ee rE eri Iais 9 12 G5 CExample RO 9 13 TCPIP_GET_SUBNETMASK GETTING THE SUBNET MASK eeeeeeceeeceeeeeeenseeesees 9 14 7 1 Descrip Misa ironia 9 14 T2 A lieth pees thick ees tha ea EES E EEE MEGS ES E EENE eee 9 14 73 Output parameters lt 2 sss asec sosectees Ash vacsision Sheets EE EEE EE eh ove Ah eee Geena 9 14 TA Returned Valles RS pe ee a E A E R T 9 14 Lee Example A ese Re A a RS ae A ee a 9 15 CHAPTER 10 PROCESSING THE REAL TIME CLOCK INTERRUPT 1 1 1 2 Introducido a eee te A ee IA A 10 1 Example NN 10 1 ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 13 Contents APPENDIX A EXAMPLE OF A STREAM SOCKET CLIENT APPENDIX B EXAMPLE OF A STREAM SOCKET SERVER APPENDIX C EXAMPLE OF A DATAGRAM SOCKET CLIENT APPENDIX D EXAMPLE OF A DATAGRAM SOCKET SERVER Page 14 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Figure 1 1 TCP IP WorldFIP Suite composition ooonocononcconocononononanonnconnonnnonn ccoo crono non nnnn conc reco nonnn cnn corn c rn ncnn ninas 1 1 Figure 3 1 Selection of the operating system ooooononococnconocononononononnnonn nono conc nnnnonn non anno nn cone cn neon nc on nono non nc cano rn nena ninas 3 2 Figure 3 2 Service Selection emocion iere e Seabee E os ET cores Ter EE E EEES ET EErEE EEr TI E
33. 8 Modify the Tools_Box OS_Adapter tbx_opt h file and if necessary the Tools_Box OS_Adapter tbx_os c file to adapt the Tools Box module to your operating system 9 Create the tbx lib library 10 Implement a Sequencer module for the messaging treated by the FIP DEVICE MANAGER for details see the FIP DEVICE MANAGER User Reference Manual ALS 50278 11 Inside the body of the real time clock handler call the tbx_TimerUpToDate function see Chapter 10 12 Start the TCP IP Stack module with the tcpip_start function 13 Start the SockAPI module with the sockapi_start function 14 Use the functions of the SockAPI module see Chapter 8 15 Use the functions of the TCP IP Stack module see Chapter 9 16 If you no longer needs to use the TCP IP Suite functions then stop the SockAPI module with the sockapi_stop function only after having received all the answers to the requests in progress 17 Stop the TCP IP Stack module with the tepip_stop function Page 2 16 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter Software configuration 3 The user has to configure the TCP IP Stack module according to his specific utilisation In the TCPIP_Stack Configuration tcpipcfg h file you can e select the target machine s operating system e define the stack services needing to be activated set the operating parameters of the various active services These parameters have been grouped into a single fi
34. CKAPI_MSGSIZE the message is too large for the socket ESOCKAP I_CONNRESET the connection is closed by the remote side ESOCKAP I_NOMEMORY memory allocation error ESOCKAPI_MAXRETRANS give up sending the message the message was repeated for the TCP_MAXRETRIES parameter of the TCP layer defined in TCPIP_Stack Configuration tcpipcfg h file ESOCKAPI_NODATA the socket has no data and the socket was created as non blocking ESOCKAPI_SOCKINUSE this socket is in use as a non connected socket ESOCKAPI_EINTR the blocking call was cancelled via a close of the socket Page 8 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 2 BASIC STRUCTURES struct sockaddr u_short sa_family char sa_data 14 y struct in_addr union struct u_chars b1 s b2 s b3 s b4 S_un_b struct u_shorts wl s w2 S_un_w u_long S addr S_un define s addr S_un S_addr should be used for all code define s host S un S un b sb2 OBSOLETE host on imp define s_net S_un S_un_b s b1 OBSOLETE network define s imp S_un S un_w s w2 OBSOLETE imp define s_impno S_un S_un_b s b4 OBSOLETE imp define slIh S un S un_b s b3 OBSOLETE logical host F struct sockaddr_in short sin_family u_short sin_port struct in_addr sin_addr char sin_zero 8 F define IP_ADDLEN 4 typedef unsigned char IPAddr IP_ADDLEN Figure 8 3 Basic structures of the socket functions The sockaddr st
35. D option in the TCPIP_Stack Configuration tcpipcfg h file FIP_DRV_IND is set to TCPIP_YES as in the case of ALSTOM WorldFIP pseudo driver gt the device driver e allocates the buffer for the received packet from its own internal resources pool e writes the received packet inside this buffer e calls the function tcpip_rcevpack with the parameter rcv_buff as a pointer to this buffer When the TCPIP_stack module has finished processing the received packet it will call the function DEV_CONTROL with the parameter arg set to FREE_MEM_DEV to tell the device driver to free the buffer O FIP DRV_IND is set to TCPIP_NO gt the user has to write a new function inside the TPIP_Stack Device_Driver_Adapter tcpipdrv c file this function we name it fip_rcev_pack must be called periodically for example from the real time clock handler The fip_rcv_pack function has to e call the device driver read function e allocate a buffer for the received packet from the TCPIP_stack internal pool created for the WorldFIP interfaces This pool is created inside the file TCPIP_Stack Basic_Stack nif c and the reference to this pool is the global variable Net fip_ pool You can use the following function for this allocation e FIP_PACK fp e fp FIP_PACK tbx_AllocateBufferInPool Net fip pool e copy the received packet inside this buffer e call the function tepip_revpack with the parameter rev_buff as a pointer to this buffer When t
36. E E E pulido 8 8 ALD NO RN 8 8 O ONO 8 8 AA Fault messages ini iio lesi n sed 8 8 4 5 Performance AN 8 8 J SOCKAPL TOCTLO certain its 8 9 5 1 Descriptor ira III Istria at 8 9 O A RR 8 10 O RS 8 10 54 Falt messages e eee aa e aE td n e a Re aa Ear ed EEES ERS NEEE OSEE SEEN eS EMS heo SIRSE 8 11 DD S A E E E ESE RN 8 11 6 CONNECT O turno ia atte oh ian Mil eS ei eee tl E oh ear Ch ae Ges 8 12 6 1 Description 8 12 A RT 8 12 63 OUMU S ut dice anes 8 12 6 4 Fault messabesin A SA A RA A tees 8 13 GS A capesseebesbates cheedsadessise S E sabes E r EE E E rT a eor EES 8 13 E SEISTEN G maria 8 14 7 1 Descriptio enen a ae e a eska a Ee I oE eie a aape ERS 8 14 T2 O RR RN 8 14 A O Eo S E E E E E E E 8 14 T Fault messages aia st rione ohn id 8 14 A ee eee Re ee ed 8 15 8 ACCEPT Oi orde 8 16 8 1 Descrip tests td ln dd licita 8 16 O NN 8 16 O ON 8 16 84 Baultmessares ini 8 17 8 37 o A NO 8 17 ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 11 Contents Y SEND a e e adas 8 18 9 1 Descrip odia ad drid de 8 18 92 A RT 8 18 OS Outputs 4 cite RR 8 19 9 4 Fault TN 8 19 O RO 8 19 10 SENDTO O arce datar 8 20 LOW Description ind 8 20 10 2 pul uni 8 21 10 37 QUIPUIS 6 sse eich aa hohe eA Sha eto A baie a oh eA ae RL 8 21 10 4 Fault messagess 2 5 sonnei eE aid aie ed win d 8 21 10 5 A EN 8 22 Tl REC 0 optar EE 8 23 ILI NN 8 23 O RR 8 24 J NN 8 24 TVA Fault messages diia fr di
37. E Eps ETE act 3 2 Figure 3 3 Timer Tick ACA O 3 3 Figure 3 4 Selection of the WorldFIP pseudo driver ssssesssssesesessssssessesessenesrnsssesesnrnsnsnseseneeninesesseneseenesenesse 3 3 Figure 3 5 Generic network interface configuration parameters ooooncnocnnoncconoconccononononnnonn nono nono nonncnn cnn nocnnecnncnnes 3 4 Figure 3 6 IP Protocol Configuration Parameters oonocnocoonnonannnnnnonecinonnnnnnanancnnnnanorononconnrnnoncrnncnne ro nana nac ro nanacnninnos 3 4 Figure 3 7 ARP Protocol Configuration Parameter ooocoocnoccnccnnnonacononnnnnonnanannnnonorononconnrnon cono cn no ro nona ronca nana cnninnos 3 5 Figure 3 8 ICMP Protocol Configuration Parameter oooonoccncccononanononnnnnonnanannnnanonononcnnncanan crono nero nona ro ncananacnninnos 3 5 Figure 3 9 UDP Protocol Configuration Parameters ooocoocnocanoncnnonannnnonananinonannnoanan anno nono nononennnranan aran cn no ro nonecnninnos 3 5 Figure 3 10 TCP Protocol Configuration ParameterlS ocoocnccnocnnononnnononnonnnnncanonanonannorononannnonnoncranan nono nona ro ncnnancnnnos 3 6 Figure 4 1 Tools Box module Configuration of the tbx_opt h file oononnnnnnncnicononnconncconcnnnconononoconocnocnncnnos 4 2 Figure 5 1 TCP IP Stack module Sequencer ooooconoccnonnconoconcnononononononnnnonnnoncnnncnnnon occ nn cone cn neon aran nono nc nn cnn nora nonn ninos 5 1 Figure 5 2 Implementation of a sequencer in a multi task CONteXt oooononnnnnnccnoccnonn
38. EV_CONTROL function see the example inSubsection 2 1 2 The device driver must free the xmit_buff after the sending operation ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 7 Software User Manual Device driver adaptation Description of the FIP_PACK and ETH_PACK structures typedef struct IPaddr nexthop unsigned short if_no unsigned short pack_len unsigned short reserved STUFFING stuffing FIP_PACKET fip_packet FIP_PACK typedef struct Ipaddr nexthop unsigned short if_no unsigned short pack_len unsigned short reserved ETH_PACKET eth_packet ETH PACK nexthop IP address of the next router if_no interface number pack_len packet length FIP_PACK or ETH_PACK reserved reserved stuffing array of 6 bytes fip_packet structure of the FIP_PACKET type defined below eth_packet structure of the ETH_PACKET type defined below Typedef struct FIP_HEADER fip_ header unsigned char data FIP_DLEN FIP_PACKET fip header structure of the FIP_HEADER type defined below data array of 256 bytes maximum that contains a WorldFIP message typedef struct ETH_ HEADER eth_header unsigned char data EP_DLEN JETH_PACKET eth_ header structure of type ETH_HEADER defined below data array of 256 bytes maximum that contains an Ethernet message Page 6 8 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation typedef struct FIP ADD
39. F_DEV_TYPE dev int ctrl void args ETH_MSG_INIT eth_msg_init eth_msg_init ETH_MSG_INIT args switch ctrl Page 6 12 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation case INIT_DEV eth_if_no eth_msg_init gt if_number tcpip_rcvpack eth_msg_init gt indication break case STOP_DEV break case FREE_MEM_DEV tox_FreeBufferInPool TBX_USER_BUFFER args break default break return 0 E E ssc ssc cocos su suscsesesuscse DEV_WRITE write operations on a device AL A Sate eee a Anis AS meee mae Ane meee i DEV_WRITE IF_DEV_TYPE dev void xmit_buff unsigned nbytes ether_packet eth_pack_wr unsigned char eth_pack ETH PACK ep struct ip pip unsigned short type unsigned short hight type unsigned short low_type unsigned i int rv ep ETH_PACK xmit_buff pip struct ip ep gt eth_packet data Ethernet destination address for i 0 i lt 6 i eth_pack_wr dest bytes i ep gt eth_packeteth_header dst i Ethernet source address for i 0 i lt 6 i eth_pack_wr src bytes i ep gt eth_packet eth_header src i protocol type type ep gt eth_packet eth_header type ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 13 Software User Manual Device driver adaptation hight_type type gt gt 8 low_type type Ox00ff unsigned char hight type unsign
40. ICE MANAGER see ALS 50278 indication address of a callback function that should be called whenever a message packet is received this field is set by the TCP IP stack module as the address of the tcpip_rcvpack function confirmation address of a callback function that should be called whenever a message is sent actually this field is not used and should be set to 0 addr_user_signal_fip _fatal_error address of a callback function that should be called whenever the driver detects a communication error addr_user_signal_fip _warning address of a callback function that should be called whenever the driver detects a communication warning memory pointer to a structure of the TBX_MEMORY_RN type defined in the file Tools_Box Tools tbx h that allows you to define a memory region if the operating system permits this to allocate all the resources for this interface if the operating system doesn t allow you to define a memory region this parameter should be set to 0 if_report return value of interface initialisation this field is set by the device driver Table 6 1 Elements of the FIP_MSG_INIT structure ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 6 5 Device driver adaptation 2 1 2 2 Description of the LSAP_DESC structure typedef struct unsigned char Isap_no FIP_ADDLEN unsigned short nb_of_rec_buf LSAP_DESC define FIP ADDLEN 3
41. OME YOUR COMMENTS AND SUGGESTIONS ALSTOM strives to produce quality technical documentation Please take the time to fill in and return the Reader s Comments page if you have any remarks or suggestions ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 5 Preface Page 6 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Reader s comments TCP IP WORLDFIP SUITE Software User ALS 53425 a en Manual Your main job is a System designer a Programmer LJ Distributor LJ Maintenance a System integrator a Operator LJ Installer QU Other specify below If you would like a personal reply please fill in your name and address below Send this form directly to your ALSTOM sales representative or to this address ALSTOM Technology Technical Documentation Department TDD 23 25 Avenue Morane Saulnier 92360 Meudon la For t France Fax 33 0 1 46 29 12 01 All comments will be considered by qualified personnel REMARKS ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 7 Reader s comments Page 8 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Contents CHAPTER 1 INTRODUCTION CHAPTER 2 GENERAL OVERVIEW OF THE SOFTWARE 1 SOFTWARE PACKAGE cieie oresar SEEE RE EE EE Irati iaa sn peste EEEE rE 2 1 1 1 O O E 2 2 132 TCP Stack module usais tii 2 3 1 33 WorldFIP pseudo device driver module oooncnnncnnccnonnconoconcconocononnonononnnonnncnnnc nono
42. PPORT if the family is not AF_INET or PF_INET used for the Internet protocol ESOCKAPI_NOTSOCK incorrect socket identifier ESOCKAPI_ISCONN the socket is already connected ESOCKAPI_INVAL incorrect argument Localaddr or the socket is already bound ESOCKAPI_FAULT incorrect address length ESOCKAPI_ADDRINUSE the local port is already used by another process 4 5 Performance This function is a non blocking function executed in the context of the user thread or process Page 8 8 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 5 SOCKAPI_IOCTL 5 1 Description The sockapi_ioct1 function allows you to set O the operating mode for a stream socket or a datagram socket blocking or non blocking O for the stream socket e the Nagle algorithm for the TCP layer e the buffered delivery from the TCP layer A stream socket or a datagram socket has 2 operating modes e blocking the operations on blocking sockets are blocking i e invoking a function which does not return until the associated operation is completed non blocking the operations on these sockets are non blocking This socket will be called a non blocking socket For a stream socket the Nagle algorithm is used by the TCP layer to reduce the number of small packets sent by a host by delaying the transmission of the acknowledgement It delays the acknowledgement in order to possibly have data going in the same direction as the acknow
43. P_ST5_FIP2 define IP_ST7_FIP2 static unsigned char static unsigned char static unsigned char 192 9 254 31 local 192 9 254 5 remote 192 9 254 7 remote LSAP Station Segment addr_st3_ fip2 0x01 Ox1F 0x01 local addr_st5 fip2 0x01 0x05 0x01 addr_st7_fip2 0x01 0x07 0x01 remote remote static IP_ HARD_COUPLE ip_sb6_fip2 0 0 0 0 IP addr addr _st5 fip2 static IP_ HARD_COUPLE ip_st7_fip2 0 0 0 0 IP addr addr_st7_fip2 ir tables static IP_HARD_COUPLE ip_eth_table 1 amp ip_eth_st2 static IP_HARD_ COUPLE ip_fip1_table 2 amp ip_st2_fip1 amp ip_st4 fipl static IP HARD COUPLE ip_fip2_table 2 Sip_st5_fip2 amp ip_st7_fip2 Page 9 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCPAP Stack module functions user_program sockapi_dot2ip ip_st2_eth ip addr IP ST2 ETH sockapi_dot2ip ip_st2_fipl ip addr IP_ST2_FIP1 sockapi_dot2ip ip_st4 fipl ip addr IP_ST4_FIP1 sockapi_dot2ip ip_st5 fip2 ip addr IP_ST5 FIP2 sockapi_dot2ip ip_st7_fip2 ip addr IP_ST7_FIP2 rv tcpip_conf_tarp eth_if_no 1 ip_eth_table if rv 0 printf n tcpip_conf_tarp Error d n rv rv tcpip_conf_tarp fip1_if_no 2 ip fip1_ table if rv 0 printf n tcpip_conf_tarp Error d n rv rv tcpip_conf_tarp fip2_if_no 2 ip fip2 table if rv 0 printf
44. R dst FIP_ ADDR src unsigned short type FIP_HEADER dst hardware destination address 3 bytes src hardware source address 3 bytes type packet type IP ARP or RARP typedef struct ETH ADDR dst ETH_ADDR src unsigned short type ETH_HEADER dst hardware destination address 6 bytes src hardware source address 6 bytes type packet type IP ARP or RARP 2 2 3 Outputs 0 gt OK 1 gt error ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 6 9 Device driver adaptation 2 3 TCPIP_RCVPACKO receiving packets 2 3 1 Description To make the system more effective for the reception of message packets the device driver has to call the TCPIP_stack callback function tcpip_revpack whose address was communicated to it at the time of its initialisation This makes it possible to avoid the use of a system call of the read type which is less effective taking into account the asynchronous nature of the reception If the driver has not this possibility to carry out the direct call of the tcpip_rcvpack function for example if one uses an already existing device driver which accepts operations of the read type then the user must periodically call the read function to this driver format the received message and call the function tcpip_rcvpack In the case of the WorldFIP device drivers there are two mechanisms for the allocation of the reception buffers according to the FIP_DRV_IN
45. RP table is updated periodically 0 TBX_MEMORY_RN static ETH_IF_PARAM eth_if_ param amp eth_general amp eth_specific 0 if report hi Figure 7 1 Definition of the Ethernet interface Page 7 8 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage WorldFIP Interface 1 LSAP Station Segment define FIP_ADDR_BRC Oxff Oxfe 0x0 hardware broadcast address LSAP Station Segment define HWAD_ST1_FIP1 0x01 0x01 0x0 hardware point to point address define IP_ST1_FIP1 192 9 250 1 IP address user callback functions to treat the FIP DEVICE MANAGER errors and warnings static void wfip1_drv_errors unsigned long int static void wfip1_drv_warnings unsigned long int static FIP_SPECIFIC fip_specificl HWAD_ST1_FIP1 hardware pointto point address FIP_ADDR_BRC hardware broadcast address NB OF_FIP_BUF 4 number of buffers to be allocated for the point to point address pool by the WorldFIP pseudo driver NB OF_FIP_BUF 4 number of buffers to be allocated for the broadcast address pool by the WorldFIP pseudo driver 0 type of message 0 aperiodical 1 periodical 0 channel number 1 to 8 for a periodical channel 0 Identifier if periodical channel wfip1_drv_errors User function to treat FDM errors wfip1_drv_warnings User function to treat FDM warn
46. TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en First issue 09 2000 Meaning ofterms that may be used in this document Notice to readers WARNING Warning notices are used to emphasize that hazardous voltages currents temperatures or other conditions that could cause personal injury exist or may be associated with use of a particular equipment In situations where inattention could cause either personal injury or damage to equipment a Warning notice is used Caution Caution notices are used where there is a risk of damage to equipment for example Note Notes merely call attention to information that is especially significant to understanding and operating the equipment This document is based on information available at the time of its publication While efforts have been made to be accurate the information contained herein does not purport to cover all details or variations in hardware or software nor to provide for every possible contingency in connection with installation operation or maintenance Features may be described herein which are not present in all systems ALSTOM assumes no obligation of notice to holders of this document with respect to changes subsequently made ALSTOM makes no representation or warranty expressed implied or statutory with respect to and assumes no responsibility for the accuracy completeness sufficiency or usefulness of the information contained herein ALSTOM gives
47. TE E EES E 9 1 1 2 Mipit parameters rear aea e rarae nE a rar E E EE E eE Ie S EOE Ea Eaa EEEE E sE IE IERE EEs E TEON 9 1 1 3 Output parameter enerne e Er r E E E E OA EE EE EEE 9 1 14 Return valles tutti diria 9 2 TCPIP_PUTADDR SETTING THE IP ADDRESS OF A LOCAL INTERFACE eee 9 3 2 1 Descriptions 5 ses ashes ice av iii Si aaa A aa 9 3 2 27 Input parameter necia ed eli 9 3 2 3 Output parametro pia 9 3 TCPIP_CONF_TARP STATIC CONFIGURATION OF THE IP ADDRESS AND HARDWARE ADDRESS CORRESPONDENCE TABLE oooooccccccnconconnnononanonnonnncnnnconocnncnnocn neon nccnnccnncnnos 9 4 3 1 Description sssini or rrr E EEr Ea Eat 9 4 3 2 Imputt parameters RN 9 4 3 3 Output parameters neiro tarna e O EE oes ET EEEE 9 4 3 4 Ret rned Vales irritada 9 5 O e nae e e ain einen ea en eer SN 9 5 TCPIP_RTADD ADDING AN ELEMENT TO THE ROUTING TABLE c cooconnccnonnnonconnconcconocnnocnnocnss 9 8 4 1 Descrip coria neta mena EET 9 8 4 2 Input parameter 9 8 4 amp 3 Output parameters ple 9 8 AVA Returned Valties cs6 ss a tenis en e ios As ee a oh 9 9 TCPIP_RTDEL DELETING AN ELEMENT FROM THE ROUTING TABLE eee 9 10 5 1 Descrip piOn somos nata is ane ista ote desirte 9 10 5 2 A eNe S sd a NEN poey vac ech su E eneee pae onee Saee SESon 9 10 X3 Ouiput parameter asisto ici can STON estas 9 10 NN 9 10 TCPIP_ECHO_RQO SENDING AN ECHO REQUEST cococonocccoconononononnnnononancnnnonanonnnconocononnnconocnecnnoo 9 11 6 1 DESC A A 9 11
48. UP AND STOPPAGE 1 TCIP_STARTO STARTUP PROCEDURE OF THE TCP IP STACK MODULE eens 7 1 1 1 Description ise aii ricas 7 1 A A ON 7 1 Ie SQUIPUUS cupos oa aioe ese 7 7 1 4 Examplesoion aiii 7 8 2 SOCKAPI_START STARTUP PROCEDURE OF THE SOCKAPI MODULE oseese 7 14 2 1 Desript oM eenei e E RE R ia pardos 7 14 222 E AN 7 14 DiS QUIUPUUS cds ono od d detent eushines 7 14 QA Fault Messa eSa eoe E T AEE ETE ong oncaanace a shen o seen E EA a E ea EE 7 14 A PerhOrimane E EE ET A E E 7 14 3 TCPIP_STOP STOPPAGE PROCEDURE OF THE TCP IP STACK MODULE ossee 7 15 Page 10 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Contents 4 SOCKAPI_STOP STOPPAGE PROCEDURE OF THE SOCKAPI MODULE ee 7 16 4 1 Descrip cios STR Te 7 16 AD SOUP US ssc aca ess ete tas see eee n 7 16 A 3 Fault Messapes n cea a Bees 7 16 44 OS 7 16 CHAPTER 8 SOCKET FUNCTIONS 1 ANOMALY REPORTS oane rosea e reenen sated bosseadbed neen eE e pae Eae ESPE E Eaei Es 8 4 2 BASIC STRUCTURES r cosets e E E EE E N E E EEE EEE E EE EEE 8 5 J SOCKET O icine aie nits Rie ae tel iio ais 8 6 3 1 Description esoe na a e ea eea e a toad O E a fs Seb TE E TO EEEo Ena EERE tats 8 6 IR E 38 else RS e da 8 6 E O i oN SE A Se eR UE eS ee ie A E ae E E E S 8 6 3 4 Fault messages eesriie innare re r eE E EEEE EET E PEES ote EE rE TEE EEr a 8 7 BS A EEEE ET 8 7 A BINDO seee id a a an ae a oai S aesae 8 8 4 1 DES CHIPU OM SEE EE A N EE E E
49. _BUF 4 number of buffers to be allocated for the broadcast address pool by the WorldFIP pseudo driver 0 type of message 0 aperiodical 1 periodical 0 channel number 1 to 8 for a periodical channel 0 Identifier if periodical channel wfip2_drv_errors User function to treat FDM errors wfip2_drv_warnings User function to treat FDM warnings static GENERAL fip_general2 wfip2 if name 0 if no is set by the TCPIP Stack module 0 0 0 0 IP addr set by calling sockapi_dot2ip 0 broadcast type specify the host value of an IP address 0 aperiodical 1 periodical MAX_FIP_MTU Maximum Transmit Unit 0 device number 0 arp policy 0 gt permanent entries in ARP table 1 gt the ARP table is updated periodically 0 TBX_MEMORY_RN hi static FIP_IF_PARAM fip_if_param2 amp fip_general2 amp fip_specific2 0 FDM interface ref 0 interface initialisation report hi Figure 7 3 Definition of the second WorldFIP interface Page 7 10 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage Definition of the IF_ETH and IF_FIP parameters static ETH_IF_PARAM tab_eth_if param 1 amp eth_if_param static IF_ETH if_eth IL nb of ETHERNET ifs tab_eth_if_param static FIP_IF_PARAM tab_fip_if_param 2 amp fip_if_ paraml amp fi
50. _NO Figure 4 1 Tools Box module Configuration of the tbx_opt h file The file Tools_Box OS_Adapter tbx_os c implements the following critical section functions to make non interruptible code sections Function Description tbx_OSInitRegion The user must place in this empty procedure the appropriate call of his operating system for the initialisation of the interrupt masking mechanism tbx_OSEnterRegion The user must place in this empty procedure the appropriate call of his operating system for interrupt masking tbx_OSLeaveRegion The user must place in this empty procedure the appropriate call of his operating system for interrupt unmasking tbx_OSDeleteRegion The user must place in this empty procedure the appropriate call of his operating system to release the various resources used for the interrupt masking mechanism Table 4 1 Tools Box module Configuration of the tbx_os c file 1 For a certain number of operating systems pSOS VxWorks etc these functions are completed You can use their default values or modify them according to your needs 2 If the WorldFIP Pseudo Driver module is used so FIP DEVICE MANAGER is used you should set the option _TBX_WITH_FDM to _TBX_OPTION_YES In this case the functions that implement the critical section are those implemented in FIP DEVICE MANAGER Page 4 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual C
51. _YES Berkeley interpretation Figure 3 10 TCP Protocol Configuration Parameters Page 3 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software configuration 11 ALLOCATED RAM MEMORY 11 1 RAM memory allocated by the TCP IP Stack module The dynamic memory size in bytes allocated by the TCP IP Stack module according to the parameters of the TCPIP_Stack Configuration tcpipcfg h file is represented as follows NB_OF_ETH_BUF SIZE_OF_ETH_BUF 24 NB_OF_FIP_BUF SIZE_OF_FIP_BUF 24 NB_OF_LRG_BUF SIZE_OF_LRG_BUF NB_OF_MSG_IN_FIFOS 64 NMAXETH ARP_TSIZE sizeof ETH_ARPEN RY see the arp h file NMAXFIP ARP_TSIZE sizeof FIP_ARPEN RY see the arp h file RT_MAX sizeof struct route see the route h file number of TCP open connections size of a TCB block The NTCB parameter defines the maximum number of connections for the TCP protocol Size of a TCB block in bytes Size of struct tcb see the tcb h file TCPSBS TCPRBS ALS 53425 a en TCP IP WORLDFIP SUITE Page 3 7 Software User Manual Software configuration 11 2 RAM memory allocated by the WorldFIP pseudo driver The dynamic memory size allocated by the WorldFIP Pseudo Driver module for a single WorldFIP interface according to the parameters of the TCPIP_Stack Configuration tcpipcfg h file is represented below According to these parameters the allo
52. agram blocking sockets the function will block till the reception of a message e Datagram non blocking sockets the function will return 1 and a call to the function sockapi_get_last_error will return ESOCKAPI_NODATA The default setting is blocking socket this setting can be changed by a sockapi_ioct1 function Function syntax include sockapi h int recv int socket char buffer int length int flags 11 2 Inputs socket a socket identifier created by the socket function buffer buffer containing the data to be transmitted length length of the data in the buffer flags not used 11 3 Outputs If no errors number of received bytes see above for more details 1 error in this case call the sockapi_get_last_error function to get the last error Page 8 24 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 11 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_INVAL incorrect argument ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_NOTCONN the socket is not connected ESOCKAP1I_MSGSIZI E the message is too large for the socket ESOCKAPI_NODATA the socket has no data and the socket was created as non blocking ESOCKAPI_CONNRESET the conne
53. arameters if number interface number this number is obtained following the call to tcpip_start ip_addr IPaddr type array all bytes must be set to 0 1 3 Output parameters ip_addr the RARP protocol is launched and the IP interface address is copied into the ip_addr table by the TCP IP Stack module ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 1 Software User Manual TCP IP Stack module functions 1 4 Returned values Value Description 0 OK 1 1f the requested interface is not initialised then it needs to be correctly initialised following the tcpip_start request 2 1f there is a system error 3 1f the interface number is incorrect 1f there is no response to the RARP request after ARP_MAXRETRY retransmissions defined in the TCPIP_Stack Configuration tcpipcfg h file 5 if the TCP IP stack has been stopped by tcpip_stop Page 9 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCPAP Stack module functions 2 TCPIP_PUTADDRO SETTING THE IP ADDRESS OF A LOCAL INTERFA CE 2 1 Description If the point to point IP address of an interface is not known and if there is no RARP server on the network then the user can obtain his IP address by implementing an application that makes use of the Bootstrap or another protocol He gets his address with an application that uses UDP and the limited broadcast IP address 255 255 255 255 The default interface that accepts limi
54. ble in TCP or UDP layer ESOCKAPI_CONNRESET the connection is closed by the remote side ESOCKAPI_MAXRETRANS glve up sending the message the message was repeated for the TCP_MAXRETRIES parameter of the TCP layer defined in TCPIP_Stack Configuration tcpipcfg h ESOCKAP I_NOMEMORY memory allocation error ESOCKAPI_INTERNALTCP internal error in the TCP layer ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 21 Software User Manual Socket functions 10 5 Performance In the case of a non blocking socket the function will return 1 and a call to the sockapi_get_last_error function will return ESOCKAPI_NOBUFS In the case of a blocking socket and if the socket is a datagram socket the function will not block the user thread or process and it will return 1 A call to the function sockapi_get_last_error will return ESOCKAPI_NOBUEF S In the case of a blocking socket and if the socket is a stream socket the function will block the user thread or process till the buffer contains enough space to copy the message and transmit it Page 8 22 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 11 RECVO 11 1 Description When an application has successfully established a socket connection it is ready to receive data over the connection An application receives data using the recv function Recv is used on stream sockets or on connected datagram sockets The behaviour of this function depends on O the nature o
55. buffer received_bytes 0 struct sockaddr amp clientaddr clientaddrlen if rv 1 error sockapi_get_last_error fprintf fd n SRVSO CK sendto Error d n error goto endserver endserver if srvsock gt 0 rv closesocket srvsock if rv 1 error sockapi_get_last_error fprintf fd n SRVSO CK close socket Error d n error srvsock 0 Page D 2 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en
56. cated memory size in bytes is as follows O For transmission NB_OF_FIP_BUF NB_OF_LRG_BUF size of an internal descriptor The size of the internal descriptor is about 80 bytes e For reception ptp_nb_rec_buf brc_nb_rec_buf size of an internal descriptor The size of the internal descriptor is about 310 bytes ptp_nb_rec_buf is the parameter if_number_of_rec_buf1 of the structure FIP_SPECIFIC used for the number of reception buffers for a point to point address The user sets this parameter when he calls the tcpip_start function brc_nb_rec buf is the parameter if_number_of_ rec _buf2 of the structure FIP_SPECIFIC used for the number of reception buffers for a broadcast address The user sets this parameter when he calls the tcpip_start function Page 3 8 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter Operating system adaptation 4 The user has to adapt the following modules to his operating system e TCPIP_Stack e Tools_Box 1 ADAPTATION OF THE TCPIP_STACK MODULE To adapt the TCPIP_Stack module you have to modify the following files e TCPIP_Stack Configuration tcpipcfg h e TCPIP_Stack OS_Adapter tcpipos c e TCPIP_Stack OS_Adapter tcpipos h To select the target machine s operating system you have to modify the TCPIP_Stack Configuration tcpipcfg h file see Chapter 3 In a multi tasking environment the TCP IP Stack module performs its various processes in parallel in the
57. cho_rq user_echo_reply exchanges an ICMP type ECHO message between two sites further details see Chapter 9 Section 6 tcpip_get_subnetmask user_mask_reply ICMP functions to send the request for a subnet mask and to receive the subnet mask further details see Chapter 9 Section 7 tcpip_conf_tarp configures in a static manner without ARP protocol the correspondence table between IP addresses and hardware addresses for the various locations further details see Chapter 9 Section 3 tcpip_getaddr requests the IP address of a local interface further details see Chapter 9 Section 1 tcpip_putaddr sets the IP address of a local interface further details see Chapter 9 Section 2 tcpip_rtadd tcpip_rtdel adds an element from the routing table further details see Chapter 9 Section 4 deletes an element from the routing table further details see Chapter 9 Section 5 Page 2 14 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en General overview of the software 7 APPLICATION CREATION 7 1 Libraries A user application for a WorldFIP network must be linked to the following modules libraries O tcpip lib library implementing the functions of the TCP IP Stack module e sockapi lib library implementing the functions of the SockAPI module O tbx lib library implementing the functions of the Tools Box module O wfip_ddrv lib library impl
58. ck int alen i struct sockaddr_in fsin int stat int last_err counter_page 1 msock passivesocketTC P service 10 if msock lt 0 fprintf fd nsocket on main sock failed code d n sockapi_get_last_error return else fprintf fd npassive socket created on port d n service continuer_server 1 while continuer_server 1 alen sizeof fsin ssock accept msock struct sockaddr amp fsin Salen ALS 53425 a en TCP IP WORLDFIP SUITE Page B 1 Software User Manual Example of a stream socket server if ssock lt 0 fprintf fd n accept failed code d n sockapi_get_last_error goto endsrv for i 0 i lt Size i Buffer i chano stat recv ssock Buffer Size 0 if stat gt 0 fprintf fd ncorrect reception n s n n Buffer sprintf buffer response page counter_page fprintf fd response_page counter_page stat send ssock header strlen header 0 if stat lt 0 fprintf fd nsend bad status code d n sockapi_get_last_error else fprintf fd send O Kin stat send ssock buffer strlen buffer 0 if stat lt 0 fprintf fd nsend bad status code d n sockapi_get_last_error else fprintf fd nsend O Kn else fprintf fd n reception failed n stat closesocket ssock counter_page if stat lt 0 last_err sockapi_get last error if last_err ESO CKAPI_CONN RESET fprintf fd nbad close sub socke
59. conoconoconccn noc no no non acc ncnnnonnninnos 5 4 Figure 5 3 Implementation of a sequencer for a MONO taSk context oocoocnoccocccnnonocanoncnnncnnancnancnnorononacnncnnoncnancnnos 5 6 Figure 6 1 Device Driver Adaptation stesosiootoocipensodi decano ossactessessesdsensosncnvtes snsivasucteseesscedenescesssevabeestensesseseesscosses 6 1 Figure 6 2 FIP MSG INTE StruGture sss siscese sscessce coxteach ects tsce sansa acess AEE a a E IE OT a ATE E A EEE a ER Ee 6 4 Figure 7 1 Definition of the Ethernet interface ooooononnnocnnonconononnnonnnancnnnconoconocnnocn nono nonnnrnn crono nn eao PEISE n i vres SEEE 7 8 Figure 7 2 Definition of the first WorldFIP interface oooononnninninnninnnnonnnonnnannnanonnnconocnnonnnco nono no cn nooo nc conc rnncnnninnos 7 9 Figure 7 3 Definition of the second WorldFIP interface ooonncncnnnnocnnocnnonconnconoconocnocn nono no nn nono non nono nono conncrnnnns 7 10 Figure 8 1 State transactions for setting up clients and servers that use stream sockets ooooonocnoccnococonoconconoconos 8 1 Figure 8 2 Transactions for setting up clients and servers that use datagram SOCKetS oooooccncnincnocnconnconcconocnnos 8 3 Figure 8 3 Basic structures of the socket functions cooonccocnononnnonnnnorananannnonnonananan co rononanonononoranan no rnnona rn ncnnanarinos 8 5 ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 15 Tables Table 4 1 Tools Box module Configuration of the tbx_o
60. created socket is a blocking socket The operations on this socket are blocking i e a function is invoked which does not return until the associated operation is completed To set the socket as non blocking you have to use the sockapi_ioct1 function after the socket function Function syntax include sockapi h int socket int family int type int protocol 3 2 Inputs family protocol family defined in the socket h file The protocol family is the same as the address family the only currently supported family is PF_INET or AF_INET for the Internet protocols type socket type SOCK_STREAM for a stream socket connection oriented socket e SOCK_DGRAM for a datagram socket connectionless socket protocol should be 0 3 3 Outputs The identifier of the socket 1 gt error in this case call the function sockapi_get_last_error to get the last error Page 8 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 3 4 Fault messages Socket functions The returning values of the function sockapi_get_last_error are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling a sockapi_start function ESOCKAPI_FAMILYNOSUPPORT if the family is not AF_INET or PF_INET used for the Internet protocol ESOCKAPI_TYPENOSUPPORT if the type of the socket is not SOCK_STREAM for a stream socket or SOCK_DGRAM for a datagram socket
61. ction is closed by the remote side ESOCKAPI_OPFORBIDDEN the operation is forbidden ESOCKAP I_NOMEMORY memory allocation error ESOCKAPI_INTERNALTCP internal error in the TCP layer 11 5 Performance In the case of a non blocking socket the behaviour of the function is described above In the case of a blocking socket the function will block the user thread or process See the conditions for unblocking above ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 25 Software User Manual Socket functions 12 RECVFROM 12 1 Description The function recvfrom is normally used to receive a message on a possibly connected socket from a specific peer socket identified by the rom parameter see below The behaviour of this function depends on O the nature of the socket stream or datagram O the operating mode blocking or not blocking O the delivery mode buffered or not buffered For more details see recv function If the from parameter is not zero then this structure will be filled with the IP address and the port of the peer which sent the data The parameter fromlen should be initialised to the size of the parameter from and modified on return to indicate the actual size of the address stored there Function syntax include sockapi h int recvfrom int socket char buffer int length int flags struct sockaddr from int fromlen 12 2 Inputs socket a socket identifier created by the socket func
62. d tcpip_ ip fifo_ empty Page 5 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 2 EXAMPLES TCP IP Sequencer On the CD package the file example tcpipmgt cpp gives you an example of how to implement a Sequencer module on a pSOS operating system 2 1 Example of a sequencer in a multi task context This example shows you how to implement a Sequencer module in a multi task context Execution contexts of the internal layers The IP layer is executed in the context of Task1 The TCP_IN layer is executed in the context of Task2 The TCP_OUT layer is executed in the context of Task3 include tcpip h SEMAPHORE_TYPE seml SEMAPHORE_TYPE sem2 SEMAPHORE_TYPE sem3 main _task create the semaphores CREATE_SEMAPHORE 1 amp sem1 CREATE_SEMAPHORE 1 amp sem2 CREATE_SEMAPHORE 1 amp sem3 user_signal_ip_rev RELEASE _SEMAPHORKE sem1 wake up the task Task1 user_signal_tcp_in_rev RELEASE SEMAPHORKE sem2 wake up the task Task2 user_signal tcp_out_rcv RELEASE_SEMAPHORE sem3 wake up the task Task3 ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 5 3 TCP IP Sequencer Task1 task initialisations while 1 ACQUIRE_SEMAPHORE sem1 tcpip_ip_fifo_empty suspend the task Task2 task initialisations while 1 ACQUIRE_SEMAPHORE sem2
63. ddress of the interface 6 bytes if_brce_hard_addr broadcast hardware address of the interface 6 bytes if_nb_of_rec_buf number of reception buffers if size of rec buf size of a reception buffer Description of the SIGNALS _ADDR structure typedef struct void addr_user_signal_tcp_in_rcv void void addr_user_signal_tcp_out_rcv void void addr_user_signal_ip_rcv void SIGNALS ADDR addr_user_signal_tcp_in rcv address of a user callback function this function is called by the TCP IP Stack module whenever the IP layer writes a message in the shared message queue between the IP layer and TCP_IN layer ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 5 Software User Manual Software startup and stoppage addr_user_signal_tcp_out_rev address of a user callback function this function is called by the TCP IP Stack module whenever the SockAPI module writes a message in the shared message queue between the SockAPI module and TCP_OUT layer addr_user_signal_ip rcv address of a user callback function this function is called by the TCP IP Stack module whenever the TCP UDP ICMP or Network Interface layers write a message in the shared message queue between these layers and the IP layer The user has to implement these callback functions he has to empty the shared queues for details see Chapter 2 Section 4 TCP IP Sequencer Description of the ICMP_RESP_ADDR structure typedef struct void addr_user_ec
64. e 3 4 Selection of the WorldFIP pseudo driver ALS 53425 a en TCP IP WORLDFIP SUITE Page 3 3 Software User Manual Software configuration 5 GENERIC NETWORK INTERFACE CONFIGURATION PARAMETERS Generic network interface configuration parameters define NMAXETH 0 max number of Ethernet interfaces should be 0 if you don t have Ethernet interface define NMAXFIP 1 max number of WorldFIP interfaces should be 0 if you don t have WorldFIP interface define NB_OF_ETH BUF 64 number of Ethernet buffers define MAX ETH MTU 1500 Ethernet Maximum Transmit Unit define SIZE_OF_ETH BUF 1524 size of Ethernet buffer MTU size of extended buffer define NB_OF_FIP_BUF 64 number of WorldFIP buffers define MAX FIP_MTU 254 WorldFIP Maximum Transmit Unit MAX FIP_MTU 2 added by the device driver define SIZE_OF_FIP_BUF 280 size of WorldFIP buffer MTU size of extended buffer define NB_OF_LRG BUF 64 number of large buffers define SIZE_OF_LRG BUF 2048 size of large buffers define NI_MAXHWA 6 max size of any hardware physical net address define NETNLEN 30 lenght of network name define NB_OF_MSG IN FIFOS 64 nb of elements of the pool used for the inter module FIFOS Figure 3 5 Generic network interface configuration parameters 6 IP PROTOCOL CONFIGURATION PARAMETERS IP protocol configuration parameters define IP_ALEN 4 IP address length
65. e associated operation is completed non blocking sockets the operations on these sockets are non blocking There are 2 types of services provided by the SockAPI library standard services as defined in Berkeley Software Distribution BSD non standard services used for launching or stopping the SockAPI library or for error handling Page 2 12 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 6 1 1 Standard services General overview of the software The following standard services are implemented Function Description socket creates a socket bind associates a socket to a local endpoint address listen sets up a connection queue in the case of a stream socket for a Server accept removes the next connection request from a Client from the above queue in the case of a stream socket for a Server and creates a new socket the Server will interact with the Client on the new created socket connect allows a Client to specify the remote endpoint address for a previously created socket in the case of a stream socket it establishes the connection recv extracts the next message that arrives on the stream socket recvfrom extracts the next message that arrives on the datagram or the stream socket send sends the message to the remote station on a stream socket sendto sends the message to the remote station on a datagram socket closes
66. e called following an ECHO response in this case the addr_user_echo_ reply is null when the tcpip_start function is called ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 11 Software User Manual TCP IP Stack module functions 6 3 Output parameters None 6 4 Returned values Value Description 0 OK 1 if the requested interface is not initialised then it needs to be correctly initialised by the function tcpip_start 1f there is a system error 3 if the TCP IP stack cannot find a route to the requested IP address if the user_echo_resp parameter is not null and the address of the ECHO response processing function is already defined the adr_ser_echo_resp parameter is non null at the time of the tcpip_start request 5 if the number of processes tasks identified by their pid and making the ECHO request is greater than the IC_MAX_ECHO_ PROC parameter defined in the TCPIP_Stack Configuration tcpipcfg h file Page 9 12 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 6 5 Example TCPAP Stack module functions define IP_ST2_ETH 192 9 230 2 distant user_program IPaddr ip_addr_st2 unsigned short pid 678 int seq_nb int data_len sockapi_dot2ip ip_addr_st2 IP_ST2_ETH seq_nb 1 data_len 20 rv tcpip_echo_rq ip_addr_st2 pid seq_nb data_len 0 static void user_echo_reply struct ip pip short len unsigned char icmp_b
67. e the communication in datagram sockets is connectionless it is not necessary to use the functions used for the creation of a connection namely connect listen and accept A client may choose to connect the datagram socket Connecting a datagram socket will cause all sends using send to go to the connected address and any datagrams received using recv from a remote address different than the connected address are discarded by the system Transmitting data on a datagram socket is not reliable This means that if an application attempts to send data to another application the system does nothing to guarantee that the data will actually be delivered to the remote application Datagram sockets are buffer oriented that means that the system does not coalesce data when sending it For example if an application makes 10 calls to sendto or send with a buffer of 300 bytes the remote application will need to perform 10 calls to recvfrom or recv with a buffer of at least 300 bytes to receive all the data ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 3 Software User Manual Socket functions 1 ANOMALY REPORTS When any of the standard functions fails the application can call the function sockapi_get_last_error to get the last error The errors are defined in the file SOCKAPI sockapi h
68. e user thread or process till the end of the graceful close sequence In the case of a datagram socket the function is not blocking and is executed in the context of the user thread or process Page 8 28 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 14 SOCKAPI_GET_LAST_ERROR 14 1 Description This function returns the last network error that occurred When a particular SockAPI function indicates that an error has occurred you should call this function to retrieve the appropriate error code Function syntax include sockapi h int sockapi_get_last_error 14 2 Outputs The return value indicates the error code for the last SockAPI function performed by this thread or process 14 3 Performance This function is a non blocking function and is executed in the context of the user thread or process ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 29 Software User Manual Socket functions 15 SOCKAPI_IP2DOT 15 1 Description This function converts the IP address ip into a string representing the address in dotted decimal form The user should reserve at least 18 bytes for the pdot buffer The function will fill the pdot buffer Function syntax include sockapi h void sockapi_ip2dot char pdot IPAddr ip 15 2 Inputs pdot address of a buffer this buffer is allocated by the user and will be filled by sockapi_ip2dot ip IP address to be converted 15 3 Performance
69. ed char low_type eth_pack_wr type 0 eth_pack_wr type 1 extended header eth_pack_wr pktlen nbytes ep_hlen eth_pack_wr pktouf char ep gt eth_packet data write the packet on the NIT device rv ether_write dev amp eth_pack_wr free the user buffer tox_FreeBufferlnPool TBX_USER_BUFFER xmit_buff return rv ESO eth_rcv_ pack read the NIT driver ETHERNET s this function must be called periodically by the user AAA OOOO OOOO ORO ROO ROSSO ROO ROO ROO RO RO ROO RO RIOR JOR JOR void eth_rcv_pack 1 ETH PACK ep struct ip pip unsigned short type unsigned short hight type unsigned short low_type ether_packet eth_rcv_pk int eth_pack_len int i ep ETH PACK tox_AllocateBufferlnPool N et eth_pool inep 0 fprintf fd n ERROR Pool eth_pool1n return eth_rcv_pk pktlen SIZE_OF_ETH_REC_BUF eth_rcv_pk pktbuf char ep gt eth_packet data eth_pack_len ether_read eth_dev_fd amp eth_rcv_pk if eth_pack_len lt 20 Page 6 14 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation tox_FreeBufferlnPool TBX_USER_BUFFER ep if errno EAGAIN fprintf fd n ERROR read Ethernet Driver d n eth_pack_len return blkcopy ep gt eth_packet eth_header dst unsigned char eth_rcv_pk dest bytes 6 blkcopy ep gt eth_packeteth_header src unsigned char eth_rcv_pk
70. eeing of a pseudo driver receipt resource run after each incoming message this operation is available only in the case of a WorldFIP interface when the option FIP_DRV_IND in the TCPIP_Stack Configuration tcpipcfg h is set to TCPIP_YES ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 3 Software User Manual Device driver adaptation args pointer to a structure that depends of the value of the ctrl parameter IF ctrl INIT_DEV THEN IF driver WorldFIP THEN args is a pointer to the structure FIP_MSG_INIT defined below ELSE driver Ethernet THEN args is a pointer to the structure ETH_MSG_INIT defined below ELSE IF ctrl STOP_DEV THEN args 0 no arguments ELSE IF ctrl FREE_MEM_ DEV THEN args pointer to the reception buffer to be freed In the case of an Ethernet WorldFIP router the interface type depends on the number of the device driver dev You can use global variables for the open devices and then perform processing according to the number of devices whose parameters are set in the DEV_CONTROL function see the example in Subsection 2 4 2 2 1 2 1 Description of the FIP_MSG_INIT structure typedef struct unsigned short protocol unsigned short if_ number TBX_POOL fip_pool unsigned short nb_of_lsaps LSAP_DESC lsap_desc_table unsigned short msg_type unsigned short channel_nr unsigned short identifier void fdm_ref void indication unsigned short void unsigned void confirmation void
71. ementing the functions of the WorldFIP Pseudo Driver module mapped on a ALSTOM FIP DEVICE MANAGER library O fdm lib library implementing the functions of a FIP DEVICE MANAGER module The names of the above libraries are only examples You can change them ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 15 Software User Manual General overview of the software 7 2 How to create an application that uses the TCP IP WorldFIP Suite package To create an application that uses the TCP IP WorldFIP Suite package you should proceed as follows 1 Modify the TCPIP_Stack Configuration tcpipcfg h file for details see Chapter 3 to adapt the parameters of the TCP IP Stack module to your context 2 Modify the TCPIP_Stack OS_Adapter tcpipos c file and if necessary the TCPIP_Stack OS_Adapter tcpipos h file to adapt the TCP IP Stack module to your operating system for details see Chapter 4 3 Modify the TCPIP_Stack Device_Driver_Adapter tcpipdrv c file if you want to map the TCP IP Stack module on an Ethernet driver or on another WorldFIP driver for details see Chapter 6 This step is not necessary if you use the WorldFIP pseudo driver module 4 Implement a Sequencer module for details see Chapter 5 5 Create the tcpip lib library 6 Create the sockapi lib library that implements the functions of the SockAPI module 7 If you use the WorldFIP pseudo driver module then e create the wfip_ddrv lib library e create the fdm lib library
72. ent may choose to call bind it is not necessary to do so Calling connect with an unbound socket will simply force the TCP IP Suite to choose an IP interface and a unique port number and will mark the socket as bound Server side connection set up Once the socket is bound the listen command will set up a queue of incoming connection requests The accept command removes the next connection request from the queue created by the listen function creates a sub socket for the request and returns the identifier of the sub socket The Server will interact with the Client on the new created socket Sending and receiving data Once the application has successfully established a socket connection it is ready to start transferring data over the connection Normally an application sends data using the send function and receives data using the recv function but the application can also use the functions sendto and recvfrom Page 8 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions Terminating a connection To terminate the connection the application has to call closesocket The following state diagrams illustrate the state transactions for setting up clients and servers that use datagram sockets Server side Client side TRE E l CLOSED CLOSED socket sendto recvfrom connect l closesocket Figure 8 2 Transactions for setting up clients and servers that use datagram sockets Sinc
73. es a network programming interface which is based on the socket paradigm popularised in Berkeley Software Distribution BSD from the University of California The access to a WorldFIP network is provided via a pseudo driver mapped on the ALSTOM FIP DEVICE MANAGER library If the user needs to access an Ethernet network then the connection to an Ethernet driver not provided by the present package can be easily created using the Device Driver Adapter functions The TCP IP stack can act as a multi host or as a router on a WorldFIP and or Ethernet network The downside of this operating system independence is a greater effort required on the part of the user who has to install the software into his own specific operating system and complete some empty functions The installation and integration steps will be covered in detail throughout this document Page 1 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter General overview of the software 2 1 SOFTWARE PACKAGE The TCP IP WorldFIP Suite package is composed of five source code directories 1 Navigation en cours Z MEG Eichier Edition Affichage gt a 7 gt Pr c dente Suivante Adresse Z Avancer 4 SC Dossie X TE TCPIP_Stack Tools_Box v WorldFIP_Pseudo_Driver 5 objet s Lo e SOCKAPL library that implements the sockets e TCPIP_Stack library that implements the TCP IP Stack e WorldFIP_Pseudo_Driver l
74. ets or on connected datagram sockets When sending data care must be taken not to exceed the maximum buffer sizes of the TCP or UDP layers O stream socket don t exceed the size defined by TCPSBS in TCPIP_Stack Configuration tcpipcfg h O datagram socket don t exceed the size defined by SIZE_OF_LRG BUF 52 in TCPIP_Stack Configuration tcpipcfg h In the case of a datagram socket if no buffer is available within the UDP layer then the function will return 1 and a call of the sockapi_get_last_error function will return ESOCKAPI_NOBUFS This behaviour is available for both a blocking and a non blocking socket In the case of a stream socket if no buffer is available within the TCP layer then for a e blocking socket the function will block till the buffer contains enough space to copy the message and transmit it non blocking socket the function will return 1 and a call to the function sockapi_get_last_error will return ESOCKAPI_NOBUFS The successful completion of send does not indicate that the data was successfully delivered Function syntax include sockapi h int send int socket char buffer int length int flags 9 2 Inputs socket a socket identifier created by the socket function buffer buffer containing the data to be transmitted length length of the data in the buffer flags not used Page 8 18 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 9 3 Outputs Socket functions If no e
75. f a client and a server component Frequently these components are isolated in separate programs sometimes they are integrated in a single application Generally they are implemented on different stations The following state diagrams illustrate the state transactions for setting up Clients and Servers that use stream sockets Client side Server side ines A l CLOSED CLOSED socket connect listen ccept LISTENING Sue RA A new sul socket y created Figure 8 1 State transactions for setting up clients and servers that use stream sockets ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 1 Software User Manual Socket functions The socket call creates an endpoint for both client and server and returns an integer which uniquely identifies the created socket The bind command is used to bind the socket to a locally specified endpoint address The local endpoint address is comprised of two elements the IP address and the port number for the socket The user has the possibility to substitute the value INADDR_ANY in place of a valid local IP address In this case the TCP IP Suite will find itself the appropriate interface If you provide a value of 0 for the sin_port field of the sockaddr_in structure then the TCP IP Suite will allocate a port number for your application Client side connection set up Once the socket is bound the connect command will establish a connection with a remote endpoint Although the cli
76. f the socket stream or datagram O the operating mode blocking or not blocking O the delivery mode buffered or not buffered Stream sockets The TCP layer delivers the received bytes in two manners e buffered delivery permits the TCP layer to deliver the receiving bytes only when sufficient data has been received only when the buffer contains at least length bytes However if the data has arrived with the PUSH bit set see TCP header then the data will be delivered immediately e unbuffered delivery permits the TCP layer to deliver as much information as currently available up to the size of length bytes In the case of a stream blocking socket if unbuffered delivery is set then the function will block till the reception of a message and the size of the delivered bytes to the user is as great as currently available up to the size of length bytes e if buffered delivery is set then the function will block till the TCP reception buffer contains at least length bytes the size of delivered bytes to the user is length bytes However if the data has arrived with the PUSH bit set see TCP header then the data will be delivered immediately and the size of the delivered bytes to the user is as great as is currently available up to the size of length bytes In the case of a stream non blocking socket e if unbuffered delivery is set and e if no bytes are received in the TCP reception buffer then the function returns 1 A call to
77. form of threads or specialised tasks These software elements must be synchronised The access to the common memory must be protected By convention these constraints are resolved by semaphores with their system dependent implementations For this the TCP IP Stack module provides in the TCPIP_Stack OS_Adapter tcpipos c file four empty predefined functions that the user has to add to the system semaphore management primitives available on his operating system The four above mentioned functions are as follows Function Description CREATE_SEMAPHORE creates a semaphore DELETE_SEMAPHORE deletes a semaphore ACQUIRE_SEMAPHORE acquires a semaphore RELEASE _SEMAPHORE releases a semaphore ALS 53425 a en TCP IP WORLDFIP SUITE Page 4 1 Software User Manual Operating system adaptation 2 ADAPTATION OF THE TOOLS BOX MODULE You have to modify the following files to adapt the Tools Box module e Tools_Box OS_Adapter tbx_opt h e Tools_Box OS_Adapter tbx_os c To select the target machine s operating system you have to modify the Tools_Box OS_Adapter tbx_opt h file see below Activating the Operating System define _TBX_WITH_FDM _TBX_OPTION_YES define _TBX_WITH_WinNTUser _TBX_OPTION_NO define _TBX_WITH_WinNTKernel _TBX_OPTION_NO define _TBX_WITH_PSOS _TBX_OPTION_YES define _TBX_WITH_VxWorks _TBX_OPTION_NO define _TBX_WITH_OtherOS _TBX_OPTION_NO define _TBX_WITH_SEMAPHORE _TBX_OPTION
78. hapter TCP IP Sequencer 5 1 MODULE DESCRIPTION The TCP IP Stack module implements the standard layers TCP IP etc The module operation causes messages to transit between the various internal layers TCP IP SOCKETS SOCKAPI TCPIP Stack user_signal_tcp_out_rcv tcpip_tcp_out_fifo empty user_signal_tcp_in _rcv tcpip_tcp_in fifo empty user _signal_ ip rcv IP tcpip_ip fifo_empty user_signal_ip_rcv tcpip ip fifo empty NETWORK INTERFACE Figure 5 1 TCP IP Stack module Sequencer The communication between these internal layers is ensured by a set of message queues Whenever a layer A for example TCP transmits a message to layer B for example IP then layer A writes a message in a shared queue between layer A and layer B and a user function of a Sequencer module will be called You can request the emptying of the queue to be processed by module B whenever you wish ALS 53425 a en TCP IP WORLDFIP SUITE Page 5 1 Software User Manual TCP IP Sequencer From the system point of view the following three activities are processed in parallel O application tasks O device drivers Sequencer module tasks The main objective of the Sequencer is to enable as far as possible the running of the TCP IP Stack module independently from the activation context of an internal layer by application tasks or device drivers Independently from the moment and the context of the send
79. he TCP IP Stack module has finished processing the received packet it will directly free this buffer Page 6 10 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation In the case of the Ethernet device drivers the user has to write a new function inside the file TPIP_Stack Device_Driver_Adapter tcpipdrv c this function we name it eth_rcv_pack must be called periodically for example from the real time clock handler The function eth_rcv_pack has to O create the device driver read function e allocate a buffer for the received packet from the TCP IP stack internal pool created for the Ethernet interfaces This pool is created inside the file TCPIP_Stack Basic_Stack nif c and the reference to this pool is the global variable Net eth_pool You can use the following function for this allocation e ETH_PACK ep 0 ep FIP_PACK tbx AllocateBufferInPool Net eth_pool O copy the received packet inside this buffer O call the tepip_rcvpack function with the rev_buff parameter as a pointer to this buffer When the TCP IP Stack module has finished processing the received packet it will directly free this buffer Function syntax include tcpip h void tcpip _rcvpack unsigned short if number void rcv_buff unsigned nbytes 2 3 2 Inputs if number interface number this number is set as a parameter field if number of the structure FIP_MSG_INIT or ETH_MSG_INIT at initiali
80. ho_reply struct ip void addr_user_mask_reply struct ip HCMP_RESP_ADDR addr_user_echo_reply address of a user callback function this function is called by the TCP IP Stack module after receiving an ECHO response as a consequence of a call by the user of the function tcpip echo_rq If this address is null it will be communicated to the TCP IP Stack module as a parameter when the user calls the function tcpip_echo_rq addr_user_mask_reply address of a user callback function this function is called by the TCP IP Stack module after receiving a SUBNET MASK response as a consequence of a call by the user of the function tcpip get_subnet_mask Page 7 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 1 3 Outputs Software startup and stoppage Value Description OK if the nb_of fip ifs field of the if_fip parameter is greater than NMAXFIP defined in the TCPIP_Stack Configuration tcpipcfg h file if the nb_of_eth_ifs field of the if_eth parameter is greater than NMAXETH defined in the TCPIP_Stack Configuration tcpipcfg h file if the nb_of_fip_ifs field of the if_fip parameter is O and the nb_of_eth_ifs field of the if_eth parameter is 0 if there is a memory problem if there is an initialisation problem for one of the timers used by the TCP IP Stack module if there is an initialisation problem for at least one WorldFIP device driver a detailed description
81. ibrary that implements a pseudo device driver for a WorldFIP network based on the FIP DEVICE MANAGER R4 library e Tools_Box library that implements a toolbox used by the above libraries e example example ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 1 Software User Manual General overview of the software 1 1 SockAPI module The SockAPI module is composed of the following files O source files EX Navigation en cours Z Mal Eg Fichier Edition Affichage gt lt 4 Pr c dente Suivante Adresse Z SOCKAPI Dossie X E in h 5 abjet s YA e sockapi c implements the SockAPI library functions O header files e inh e socket h e sockapi h O miscellaneous files e makefile example of a make file to build the SockAPI library this make file has to be modified by the user file paths etc Page 2 2 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en General overview of the software 1 2 TCP IP Stack module The TCP IP Stack module is composed of the following directories Navigation en cours Z AT Ml Eg SUNY arate 2 Basic_Stack J Configuration J Device_Driver_Adapter 3 OS_Adapter makefile tcpipcfg h contains the TCP IP Stack parameters you should modify this file according to the utilisation context ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 3 Software User Manual Gene
82. ing layer request the user can choose the moment and the context to run the processing code of a destination layer Each time a message is written in a message queue the TCP IP Stack activation manager is warned of the fact that one of the queues is not empty when he calls the user_signal_xxx_rcv function reserved for this purpose The user must write this function The following functions empty the message queues Function Description tcpip ip fifo empty empties the IP queues these queues are written by the UDP ICMP TCP_OUT layers and the Network Interface tcpip_tcp_out_fifo_empty empties the TCP_OUT queue this queue is written by the SOCKAPI module each time a message is sent tcpip_tcp_in_fifo_empty empties the TCP_IN queue this queue is written by the IP module 1 The addresses of the user functions user_signal_ip_rev user_signal_tcp_in rcv user_signal_tcp_out_rcv are transmitted to the TCP IP Stack module at the time of the call of the tcpip_start function 2 If you have a multi task operating system then inside the body of the user_signal_xxx_rcv functions you have to activate a task that will empty the message queue never call the tcpip_xxx_fifo empty function inside the body of the user_signal_xxx_rcv function because its execution context should be different Syntax include tcpip h void tcpip_tcp_in fifo empty void tcpip_tcp_out_fifo_ empty voi
83. ings static GENERAL fip_generall wfip1 if name 0 if no is set by the TCPIP Stack module 0 0 0 0 IP addr set by calling sockapi_dot2ip 0 broadcast type specify the host value of an IP address 0 aperiodical 1 periodical MAX_FIP_MTU Maximum Transmit Unit 0 device number 0 arp policy 0 gt permanent entries in ARP table 1 gt the ARP table is updated periodically 0 TBX_MEMO RY_RN de static FIP_IF_PARAM fip_if_paraml amp fip_generall amp fip_specificl 0 FDM interface ref 0 interface initialisation report E Figure 7 2 Definition of the first WorldFIP interface ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 7 9 Software startup and stoppage WorldFIP Interface 2 LSAP Station Segment define HWAD_ST1_FIP2 0x01 Ox1F 0x1 hardware point to point address define IP_ST1_FIP2 192 9 254 31 IP address user callback functions to treat the FIP DEVICE MANAGER errors and warnings static void wfip2_drv_errors unsigned long int static void wfip2_drv_warnings unsigned long int static FIP_SPECIFIC fip_specific2 HWAD_ST1_FIP2 hardware point to point address FIP_ADDR _BRC hardware broadcast address NB_OF_FIP_BUF 4 number of buffers to be allocated for the point to point address pool by the WorldFIP pseudo driver NB_OF_FIP
84. is connected on a Ethernet network segment that has 2 stations connected itself 1 other station IP and hardware addresses of the stations on the Ethernet network define IP_ST1_ETH 192 9 230 1 local define IP_ST2_ETH 192 9 230 2 remote static unsigned char eth_addr stl 0x8 0 0x20 Ox1f 0x44 0x67 local static unsigned char eth_addr_st2 0x8 0 0x20 4 Oxf 0x37 remote static IP_ HARD_COUPLE ip_eth_stl 0 0 0 0 IP addr eth_addr_stl static IP_ HARD_COUPLE ip_eth_st2 0 0 0 0 IP addr eth_addr_st2 i IP and hardware addresses of the stations on the WorldFIP1 network define IP_ST1_FIP1 192 9 250 1 local define IP_ST2_FIP1 192 9 250 2 remote define IP_ST4_FIP1 192 9 250 4 remote ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 5 Software User Manual TCP IP Stack module functions LSAP Station Segment static unsigned char static unsigned char static unsigned char addr_stl_fip1 0x01 addr_st2 fip1 0x01 addr _st4 fip1 0x01 0x01 0x0 local 0x02 0x0 remote 0x04 0x0 remote static IP_ HARD_COUPLE ip_st2_fip1 0 0 0 0 addr_st2_fip1 static IP_ HARD_COUPLE ip_st4_fip1 10 0 0 0 addr_st4 fipl i IP addr IP addr IP and hardware addresses of the stations on the WorldFIP2 network define IP_ST3_FIP2 define I
85. le O WORLDFIP_PSEUDO DRIVER must be set to TCPIP_ YES O FIP_DRV_IND must be set to TCPIP_YES If you want to map the TCP IP Stack module on an Ethernet driver or on another WorldFIP driver you have to modify the TCPIP_Stack Device_Driver_Adapter tcpipdrv c file for further details see Chapter 6 If you use the pseudo driver mapped on the ALSTOM FIP DEVICE MANAGER library then you don t have to modify this file 6 USER INTERFACE The user can access the TCP IP communication functions via O Socket functions e TCP IP Stack functions 6 1 Socket functions The SockAPI module defines a network programming interface which is based on the socket paradigm popularised in Berkeley Software Distribution BSD from the University of California A socket defines a bi directional endpoint for communication between processes on the same or on different machines The Sockets specification is intended to provide a single API with an abstraction of the networking software below it The present SockAPI implementation provides an abstraction for the TCP IP Stack developed by ALSTOM The SockAPI library offers service for both connection oriented TCP and connectionless UDP protocols A connection oriented socket is called a stream socket and a connectionless socket is called a datagram socket There are 2 socket types e blocking sockets the operations on these sockets are blocking i e invoking a function which does not return until th
86. le They are represented by functional groups from Figure 3 1 to Figure 3 10 ALS 53425 a en TCP IP WORLDFIP SUITE Page 3 1 Software User Manual Software configuration 1 SELECTION OF THE TARGET MACHINE S OPERATING SYSTEM The figure below shows you the defines that you can use to select the processor type the operating system and the task architecture Figure 3 1 Selection of the operating system 2 ACTIVATION OF THE TCP IP STACK S OPTIONAL SERVICES Basic services such as IP ARP or ICMP are active by default The user should activate the other services TCP UDP RARP FRAGMENT and RIP The following figure contains the list of optional services Figure 3 2 Service Selection Page 3 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software configuration 3 SET THE VALUE OF THE TIMER TICK Timer Tick Value define TIMER_TICK 100 measured in milliseconds Figure 3 3 Timer Tick Value 4 SELECTION OF THE WORLDFIP PSEUDO DRIVER Selection of the network interface pseudo driver define FIP_DRV_IND TCPIP_YES Reception mode of WorldFIP packets TCPI_YES direct call by the driver of the function tcpip_rcvpack TCPI_NO the user must implement a function of the driver and then call tcpip_rcvpack define WORLDFIP_PSEUDO_ DRIVER TCPIP_YES use of the ALSTOM WorldFIP pseudo driver TCPIP_YES if the WorlFIP pseudo driver is used TCPIP_NO if the WorlFIP pseudo Figur
87. ledgement so the acknowledgement can be sent along with the data the value of the delay is set to TCP_ACKDELAY defined in TCPIP_Stack Configuration tcpipcfg h file For a stream socket the TCP layer delivers the received bytes in two manners e buffered delivery permits TCP layer to deliver the receiving bytes only when sufficient data has been received only when the buffer contains at least length bytes specified by the functions recv or recvfrom However if the data has arrived with the PUSH bit set see TCP header then the data will be delivered immediately e unbuffered delivery permits TCP layer to deliver as much information as is currently available up to the size of length bytes specified by the functions recv or recvfrom By default a created O stream socket or datagram socket is a blocking socket O stream socket has e the Nagle algorithm disabled e the buffered delivery disabled ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 9 Software User Manual Socket functions The sockapi_ioctl function is accepted only by a main socket all the sub sockets resulting from a accept function will inherit the same properties as the main socket Function syntax include sockapi h int sockapi_ioctl int socket int command char arg 5 2 Inputs socket a socket identifier created by the socket function command it accepts the following values e FIONBIO for setting the operating mode of the socket e TCPOPTS fo
88. ly struct ip pip struct icmp picmp unsigned char subnet_mask 4 short i picmp struct icmp pip gt ip_data memcpy char subnet_mask char picmp gt ic_data 4 fprintf fd Subnet mask for i 0 i lt 4 i printf x subnet_mask i printf n ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 15 Software User Manual TCP IP Stack module functions Page 9 16 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter Processing the real time clock interrupt 10 1 1 Introduction The hardware environment should have a programmable timer that periodically produces interrupts You should connect the interrupt vector to the interrupt handler This operation depends on the user hardware environment and operating system The user has to call the tbx_TimerUpToDate function inside the body of the interrupt handler The period for calling the tbx_TimerUpToDate function must correspond to the value TIMER_TICK set by the user in the file TCPIP_Stack Configuration tcpipcfg h 1 2 Example handler_timer tox_TimerUpToDate ALS 53425 a en TCP IP WORLDFIP SUITE Page 10 1 Software User Manual Processing the real time clock interrupt Page 10 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Appendix Example of a stream socket client A include sockapi h define ECHO _PORT 7 define DAYTIME PORT 13 define TIME_PO RT 37
89. mer ticks define ARP_TIMEOUT60 ARP_RESEND time out for removing temporary entries in the ARP table must be a multiple of ARP_RESEND define ARP_MAXRETRY 4 maximum retransmission for ARP and RARP Figure 3 7 ARP Protocol Configuration Parameters 8 ICMP PROTOCOL CONFIGURATION PARAMETERS ICMP protocol configuration parameters define IC_RDTTL 300 Time To Live for redirect routes define IC_MAX_ECHO PROC 3 Maximum number of process using the echo request Figure 3 8 ICMP Protocol Configuration Parameters 9 UDP PROTOCOL CONFIGURATION PARAMETERS UDP protocol configuration parameters define UPPS 11 max number of UDP ports define ULPORT 2050 initial UDP local port number allocated by the stack if the user don t specify it Figure 3 9 UDP Protocol Configuration Parameters ALS 53425 a en TCP IP WORLDFIP SUITE Page 3 5 Software User Manual Software configuration 10 TCP PROTOCOL CONFIGURATION PARAMETERS TCP protocol configuration parameters define MAX ACT PORTS define MAX PAS PORTS 0 max number of active ports for clients 1 max number of passive ports for servers define MAX ACCEPTED _CX_ON_A PAS PORT 5 max number of accepted connections for each define NTCB define TCPSBS define TCPRBS Important remark passive port MAX ACT PORTS MAX PAS PORTS 1 MAX ACCEPTED_CX_ON_A PAS PORT number of TCB blocks number of active por
90. mum Transmit Unit if _ dev dev number of the device driver the user has to set the IF_DEV_TYPE type in the TCPIP_Stack Device_Driver_Adapter tcpipdrv h file 1f necessary if _arp policy type of the ARP policy concerning the contents of the ARP table 0 the content of this table is permanent 1 the table will be Reset periodically period ARP_TIMEOUT to be set in the file TCPIP_Stack Configuration tcpipcfg h and ARP requests will be issued if memory pointer to a structure of the TBX_MEMORY_RN type defined in the Tools_Box Tools tbx h that allows you to define a memory region if the operating system permits this where all the resources will be allocated for this interface if the operating system doesn t allow you to define a memory region then this parameter should be set to 0 Description of the IPaddr type typedef unsigned char IPaddr IP_ALEN IP_ALEN IP address length is the IP_ALEN parameter in the file TCPIP_Stack Configuration tcpipcfg h Description of the FIP_SPECIFIC structure typedef struct FIP ADDR if station _hard_addr FIP ADDR if brc_hard_addr unsigned short if nb_of rec bufl unsigned short if nb_of rec _buf2 unsigned short if_ msg_type unsigned short if_channel_nr unsigned short if_ident void addr_user_signal_fip fatal_error unsigned long int void addr_user_signal_fip_warning unsigned long int FIP_SPECIFIC if_station_hard_addr point to poin
91. no warranties of merchantability or fitness for purpose shall apply In this publication no mention is made of rights with respect to trademarks or tradenames that may attach to certain words or signs The absence of such mention however in no way implies there is no protection Partial reproduction of this document is authorized but limited to internal use for information only and for no commercial purpose However such authorization is granted only on the express condition that any partial copy of the document bears a mention of its property including the copyright statement All rights reserved O Copyright 2000 ALSTOM Paris France Page 2 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Revisions Index Nature of revision letter ALS 53425 a en TCPAP WORLDFIP SUITE Software User Manual Page 3 Revistons Page 4 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Preface 1 CONTENT OF THIS MANUAL Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Appendix A Appendix B Appendix C Appendix D Introduction Short description of the composition of the TCP IP WorldFIP Suite General overview of the software Describes the source code directories of the software package and the user interface socket functions TCP IP Stack functions and the creation of an application Software configuration Desc
92. nocn no cnn con nora ncnnccnnos 2 7 1 4 Tools BOX Mode it tii 2 8 LS Examplescoin ainia iii 2 10 2 SOFTWARE CONFIGURATION i n a A EEE ES E none AEO E on nr A STIRE 2 11 3 OPERATING SYSTEM ADAPTATION nnen epee ae es eE IS eo ep ea AEE Na Op eE N Tsart 2 11 4 TCP IP SEQUENCER viceri ar eE S EE E E SEE a rE ioa 2 11 3 DEVICEDRIVERADAPTATION srin iea a a E E e E S SS 2 12 6 USERTNTERFACE coito ie A in 2 12 6 1 SOCK EL PUNCH ONS ett dids 2 12 6 1 1 O NN 2 13 6 1 2 Non standard SErVICES usada dl odds 2 13 6 2 TCP IP Stack specific TUnctions seecsvessecavesseevscess ey sachseetsesces chesnssegss ep EESE SKEE r ere rE E SESS 2 14 T APPLICATION CREATION oesie ae oasen nenea oerna SR E Ae EEEE e Sa VE O KEET donee 2 15 7 1 ibian NA 2 15 7 2 How to create an application that uses the TCP IP WorldFIP Suite package oooonncnnnnmnmm m m 2 16 CHAPTER 3 SOFTWARE CONFIGURATION 1 SELECTION OF THE TARGET MACHINE S OPERATING SYSTEM ooococonoccconcconccnnonnconncnnncnnncnnninnos 3 2 2 ACTIVATION OF THE TCP IP STACK S OPTIONAL SERVICES ocooncccoccnoncnncnononannnnnnonccnncnnncnncconoss 3 2 3 SET THE VALUE OF THE TIMER TICK wie cc ie ae ee E E E E e natin tien anes 3 3 4 SELECTION OF THE WORLDFIP PSEUDO DRIVER ococonocccococonconononnonnnonoconoconoconocnnccnnornnonnncnncrinannos 3 3 5 GENERIC NETWORK INTERFACE CONFIGURATION PARAMETERS coooocococccncconcccnnonnnoncconccinoss 3 4 6 IP PROTOCOL CONFIGURATION PARAMETERS
93. ns ALS 53425 a en TCP IP WORLDFIP SUITE Page 5 5 Software User Manual TCP IP Sequencer handler_timer activation by a timer each 10 msec handler_timer static int active_timer 0 if active _timer 10 0 tox TimerUpToDate each 100 msec else if activer 1 activer_modules active_timer static void activer_modules activer 0 empty the IP message queue tcpip_ip_fifo_empty empty the TCP_IN message queue tcpip_tcp_in_fifo_empty empty the TCP_O UT message queue tcpip_tcp_out_fifo_empty activer 1 static void user_signal_tqp_in_rcv void msg static void user_signal_tcp_out_rcv void msg static void user_signal_ip_rcv void msg Figure 5 3 Implementation of a sequencer for a mono task context Page 5 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Chapter Device driver adaptation 6 1 OVERVIEW The access to a WorldFIP network is provided via a pseudo driver mapped on the ALSTOM FIP DEVICE MANAGER library In this case you have to set the following options in the TCPIP_Stack Configuration tcpipcfg h file 0 WORLDFIP_PSEUDO_DRIVER must be set to TCPIP_YES O FIP_DRV_IND must be set to TCPIP_YES Modify the TCPIP_Stack Device_Driver_Adapter tcpipdrv c file if you want to map the TCP IP Stack module on an Ethernet driver or on another WorldFIP driver If you use the
94. number of lt IP Addr gt lt Hard Addr gt couples in the table pointed to by ip hard table ip hard table pointer to a table of nb_of_couples pointers to IP_HARD_COUPLE type structures as defined below ip_addr IP address of a remote workstation hw_addr pointer to a 3 byte WorldFIP or 6 byte Ethernet array providing the hardware address of the remote workstation typedef struct Ipaddr ip_addr unsigned char hw_adar HP_HARD_COUPLE 3 3 Output parameters None Page 9 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCPAP Stack module functions 3 4 Returned values Value Description 0 OK 1 if the requested interface is not initialised then it needs to be correctly initialised by the tcpip_start function 2 if there is a system error if the interface number is incorrect 4 if the nb_of_couples parameter is greater than ARP_TSIZE defined in the TCPIP_Stack Configuration tcpipcfg h file 3 5 Example Let us suppose that there are 1 Ethernet interface and 2 ALSTOM WorldFIP interfaces see the example used for the description of the utilisation of the tcpip_start function e WorldFIP1 interface is connected on a WorldFIP network segment that has 3 stations connected itself 2 other stations e WorldFIP2 interface is connected on a WorldFIP network segment that has 3 stations connected itself 2 other stations e Ethernet interface
95. oceeding with the stop request the user must make sure that all his requests in progress have been finished Then he must close all the open connections UDP and TCP and block the TCP IP Sequencer tasks In case of use of TCP protocol after the closing of the stream sockets it is necessary to wait a time greater than TCP_TWOMSL defined in the TCPIP_Stack Configuration tcpipcfg h file before proceeding to the stop request Function syntax include tcpip h void tcpip_stop ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 15 Software User Manual Software startup and stoppage 4 SOCKAPI_STOP STOPPAGE PROCEDURE OF THE SOCKAPI MODULE 4 1 Description The sockapi_stop function allows a user to stop the SockAPI library services Function syntax include sockapi h SNE sockapi_stop 4 2 Outputs Value Description OK error in this case call the sockapi_get_last_error function to get the last error 4 3 Fault messages The returning value of the sockapi_get_last_error function is ESOCKAPI_NOTINITIALISED lt attempts to call a library function without first calling previously the sockapi_start function 4 4 Performance This function is a non blocking function executed in the context of the user thread or process Page 7 16 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Chapter Socket functions S Generally a network application consists o
96. ocket terminates the connection gracefully and removes the socket 6 1 2 Non standard services The following non standard services are implemented Function Description sockapi_start This function must be the first function called by an application it initialises the internal library resources sockapi_stop This function must be the last function called by an application when the application no longer needs the library functions sockapi_get_last_error When any of the standard functions fails the application can call this function to get the last error sockapi_ioct1 This function can set e the operating mode of a socket blocking or non blocking e the Nagle algorithm for the TCP layer e the buffered delivery mode from the TCP layer sockapi_ip2dot converts an IP address into a dotted decimal string sockapi_dot2ip converts a dotted decimal string into an IP address ALS 53425 a en TCP IP WORLDFIP SUITE Software User Manual Page 2 13 General overview of the software 6 2 TCP IP Stack specific functions The TCP IP Stack specific functions in the following list are detailed in the following sections Function Description tcpip_start starts the TCP IP Stack module further details see Chapter 7 Section 1 tcpip_stop stops the TCP IP Stack module further details see Chapter 7 Section 3 tcpip_e
97. odify this file according to the utilisation context Page 2 8 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual General overview of the software e The Tools directory is composed of the following files EX Navigation en cours Z Mal Ea Eichier Edition Affichage gt se Pr c dente Suivante 7 objet s V3 O source files e tbx_dicho c implements the functions of some sorting algorithms e tbx_fifo c implements FIFO management functions e tbx_gdm c implements memory management functions e tbx_gdt c implements time out management functions e tbx_lai c implements inter module management functions e tbx_version c gets version number of the Tools Box Software O header files e tbx h contains the definitions of the Tools Box module O miscellaneous files e makefile example of a make file to build the Tools Box library you should modify this make file file paths etc ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 9 Software User Manual General overview of the software 1 5 Example This directory contains an example of a pSOS system that shows you how to O start and implement the operating system adaptation and the sequencer of the TCP IP Stack module manage the FIP DEVICE MANAGER messaging mechanism The Example directory is composed of the following files EX Navigation en cours Z TCP IP TC Mal EG Fichier Edition Affichage Aller amp Faw gt
98. only limit is the number of available TCP descriptors for a passive connection defined by the MAX_ACCEPTED_CX_ON_A PAS PORT parameter in the TCPIP_Stack Configuration tcpipcfg h file in the TCP IP suite 7 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error 7 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_ISCONN the socket is already connected ESOCKAPI_OPNOTSUPP the socket type does not support listen ESOCKAP I_NOTBOUND the socket is not bound ESOCKAPI_INTERNALTCP internal error in the TCP layer ESOCKAPI_NOMEMORY memory allocation error ESOCKAPI_EINTR the blocking call was cancelled via closing of the ESOCKAPI_NOBUES socket if the number of open passive sockets is equal to MAX_PAS_ PORTS defined in TCPIP_Stack Configuration tcpipcfg h Page 8 14 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 7 5 Performance This function is a non blocking function and is executed in the context of the user thread or process ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 15 Software User Manual Socket functions 8 ACCEPTO 8 1 Description In the case of a s
99. p_if_ param2 i static IF_FIP if fip 4 2 nb of FIP interfaces tab_fip_ if param Jie Definition of the user callback functions used for the TCP IP Sequencer static void tcp_in_rcv static void tcp_out_rcv static void ip_rcv static SIGNALS ADDR _ signals addr tcp_in_rcv tcp_out_rcv ip_rcv E Definition of the user callback functions used to treat the responses of an ECHO request call of tcpip echo_rq and of a Get Subnet Mask request call of tcpip_get_subnet_mask static void user_echo_reply struct ip static void user_mask_reply struct ip static ICMP_RESP_ADDRicmp_resp_addr user_echo_reply user_mask_reply Me ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 11 Software User Manual Software startup and stoppage Call of the tcpip_start function include sockapi h device drivers handles IF_DEV_TYPE eth _dev fd IF_DEV_TYPE fip1_dev_fd IF DEV_TYPE fip2_dev_fd interface numbers unsigned short eth_if_no unsigned short fip1_if_no unsigned short fip2_if_no FIP DEVICE MANAGER context references for each WorldFIP interface static FDM_REF FULLFIP1 see FDM User Manual static FDM_REF FULLFIP2 open yourETHERNET device driver by a open function and get the device driver handle eth_dev_fd set the fields if_dev et if_ip addr of eth_general structure eth_general if_dev IF_DEV_TYPE
100. p_out c contains the output functions of the TCP protocol tcp_pdrv c contains the functions of a TCP pseudo driver tcp_time c contains the time out management functions of the TCP protocol udp c contains the functions of the UDP protocol udp_pdrv c contains the functions of a UDP pseudo driver TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en General overview of the software O header files arp h contains the type definitions used by the ARP protocol icmp h contains the type definitions used by the ICMP protocol ip h contains the general type definitions used by the IP protocol ipreass h contains the type definitions used by the IP protocol for frame fragmentation assembly netif h contains the type definitions of the Network Interface module network h contains the macro transcription of the types little endian big endian rarp h contains the type definitions used by the RARP protocol rip h contains the type definitions used by the RIP protocol route h contains the type definitions used by the IP protocol for routing snmpvars h contains the type definitions used for statistics management tcb h contains the type definitions used by the TCP protocol for the description of the TCB Transmission Control Block tcp h contains the general type definitions used by the TCP protocol tcp_pdrv h contains the type definitions used by the TCP pseudo driver tcpfsm h contains the type defini
101. pos h e Tools_Box 0S_Adapter tbx_opt h e Tools_Box 0S_Adapter tbx_os c For further details see Chapter 4 4 TCP IP SEQUENCER The TCP IP Stack module implements the standard layers TCP IP etc The operation of this stack module causes messages to transit between the various internal layers TCP IP The communication between these internal layers is ensured by a set of message queues Whenever layer A for example TCP transmits a message to layer B for example IP then layer A writes a message in a shared queue between layer A and layer B a user function of a Sequencer module will be called You can request the emptying of the queue to be processed by module B whenever you wish The main objective of this mechanism is to enable as far as possible the running of the TCP IP Stack module independently from the activation context of an internal layer The user can choose the time and the context to run the processing code of a destination layer independently of the moment and the context of the request by a sending layer The user has to implement the Sequencer module see Chapter 5 ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 11 Software User Manual General overview of the software 5 DEVICE DRIVER ADAPTATION The access to a WorldFIP network is provided via a pseudo driver mapped on the ALSTOM FIP DEVICE MANAGER library In this case you have to set the following options in the TCPIP_Stack Configuration tcpipcfg h fi
102. pseudo driver mapped on ALSTOM FIP DEVICE MANAGER library then you don t have to modify this file The TCP IP Stack s Network Interface layer requires an interface with a pseudo device driver in the form of the three following functions and in compliance with the diagram shown below TCPIP stack NETWORK INTERFACE DEV_WRITE E tcpip_rcvpack Ethernet a WorldFIP E driver driver S AA Figure 6 1 Device Driver Adaptation ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 1 Software User Manual Device driver adaptation DEV_CONTROL handles device driver control operations Its role is three fold it e initialises the resources and elements required for driver messaging run once only at TCP IP Stack startup e requests freeing of all pseudo driver resources run once only at complete stop of the TCP IP Stack e requests freeing of a pseudo driver receive resource run after each incoming message 0 DEV WRITE for issuing messages to the network driver 0 tcpip_rcvpack the pseudo driver needs to call this function to inform of and forward each received message to the TCP IP stack The address of this function is transmitted to the device driver by the Network Interface layer at TCP IP Stack start up Page 6 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation 2 FUNCTIONS 2 1 DEV_CONTROLO control operations 2 1 1 Description The TCP IP
103. r setting the Nagle algorithm and or the buffered delivery arg a pointer to a command parameter If the command is FIONBIO then arg points to an integer with the following values 0 gt sets the socket as blocking gt 0 gt sets the socket as non blocking 0 TCPOPTS then arg points at an integer with the following values e TCBF_DELACK enables the Nagle algorithm e TCBF_BUFFER enables the buffered delivery e TCBF_DELACK TCBF_BUFFER enables the Nagle algorithm and the buffered delivery 5 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error Page 8 10 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 5 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_NOTSOCK incorrect socket identifier or a sub socket ESOCKAPI_ISCONN the socket is already connected ESOCKAPI_INVAL incorrect argument ESOCKAPI_OPNOTSUPP 1f trying to apply the TCPOPTS command on a datagram socket 5 5 Performance This function is a non blocking function and is executed in the context of the user thread or process ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 11 Software User Manual Socket functions 6 CONNECT 6 1 Description The connec
104. ral overview of the software e The Basic_Stack directory is composed of the following files t Navigation en cours Z TCP IP TCPIP_Suite R1_0 TCPI la Ea Fichier Edition Affichage Allera Favoris Outils 2 a Pr c dente Adresse Dossie X gt Suwane r An Dossier parent Se connecte E ip h a ip_frag c ar ip_route c a ipreass h E netif h lar network h a nif c 8 rip h ar route h ar snmpyars h E tcb h ar tcp h E tep_fe c a tcp_fsm c ar tep_in c E tep_out c E tep_pdrv c E tep_pdrw h la tcp_time c Z TCPIP_Stack Basic_Stack E tcpipeth h 8 tepipfip h udp_pdrv h E rarp c E rarp h 37 objet s E zone intranet Y a tepfsm h 8 tcpip h O source files Page 2 4 arp c contains the functions of the ARP protocol icmp c contains the functions of the ICMP protocol ip c contains the general functions of the IP protocol ip_frag c contains the fragmentation and assembly functions of the IP protocol ip_route c contains the routing functions of the IP protocol nif c contains the initialisation functions of the TCP IP module rarp c contains the functions of the RARP protocol tcp_fc c contains the control of flow and adaptive retransmission functions of the TCP protocol tcp_fsm c contains the state machines functions of the TCP protocol tcp_in c contains the input functions of the TCP protocol tc
105. rces for this interface If the operating system doesn t allow you to define a memory region then this parameter should be set to 0 if_fip pointer to a structure that describes the parameters of the WorldFIP interfaces the IF_FIP type is described below If you don t have WorldFIP interfaces then this parameter should be set to 0 if_eth pointer to a structure that describes the parameters of the Ethernet interfaces the IF_ETH type is described below If you don t have WorldFIP interfaces then this parameter should be set to 0 signals_addr pointer to a structure of type SIGNALS_ADDR described below which makes it possible to provide the TCP IP Stack module with the callback addresses of the functions used for the Sequencer see Chapter 5 user_signal_ip rcv ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 1 Software User Manual Software startup and stoppage user _signal_tcp in _rcv anduser_signal_tcp_out_rcv icmp_resp_addr pointer to a structure of the ICMP_RESP_ADDR type described below which makes it possible to inform the TCP IP Stack module of the callback addresses of the functions 0 user_echo reply user callback function that will be called by the TCP IP Stack module whenever it receives an ECHO response as a consequence of an ECHO request 0 user_mask_reply user callback function that will be called by the TCP IP Stack module whenever it receives a Subnet Mask response as a consequence of a S
106. re User Manual ALS 53425 a en Example of a datagram socket client if sock1 gt 0 rv closesocket sock1 if rv 1 error sockapi_get_last_error fprintf fd An SO CK1 close socket Error din error sockl 0 pex ECHO CLIENT 2 blocking connected datagram with bind sock2 socket PF_INET SOCK_DGRAM 0 if sock2 1 error sockapi_get_last_error fprintf fd in SO CK2 socket Error d n error goto endclient bind to a local endpoint localaddr2 sin_family AF_INET localaddr2 sin_addr s_ addr INADDR ANY localaddr2 sin_port 3000 ECHO_PORT rv bind sock2 struct sockaddr amp localaddr2 sizeof localaddr2 if rv 1 error sockapi_get_last_error fprintf fd n SO CK2 bind Error d n error goto endclient connect the socket remoteaddr2 sin_family AF_INET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr2 sin_addr unsigned char rip IP_ADDLEN remoteaddr2 sin_port ECHO _PORT rv connect sock2 struct sockaddr amp remoteaddr2 sizeof remoteaddr2 if rv 1 error sockapi_get_last_error fprintf fd in SO CK2 connect Error d n error goto endclient for j 16 j lt 32 j Send and Receive for i 0 i lt 100 msgli j i rv send sock2 msg 100 0 if rv 1 error sockapi_get_last_error fprintf fd n SO CK2 send Error d n er
107. rect address length ESOCKAPI_NOLISTEN listen operation was not invoked prior to accept operation ESOCKAPI_NOBUF S no more sub socket descriptors are available the maximum number that can be created is given by the MAX_ACCEPTED_CX_ON_A PAS PORT parameter defined in the TCPIP_Stack Configuration tcpipcfg h file ESOCKAP1_NOCONR 5a 10 the socket is non blocking and no connection requests are present in the queue to be accepted ESOCKAPI_INTERNALTCP internal error in the TCP layer ESOCKAPI_EINTR the blocking call was cancelled via closing of the socket 8 5 Performance In the case of a non blocking socket if there are no connection requests in the queue then the function returns 1 A call to the function sockapi_get_last_error will return ESOCKAPI_NOCONREQ In the case of a blocking socket if there are no connection requests in the queue then the function will block the calling thread or process till the reception of a connection request from a Client This blocking call can be cancelled by another thread that performs closes the socket that is used by accept ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 17 Software User Manual Socket functions 9 SENDO 9 1 Description Once an application successfully establishes a socket connection it is ready to transfer data over the connection An application sends data using the send function Send is used on stream sock
108. ribes the configuration parameters selection of the target machine operating system definition of the stack services setting of the operation parameters of the active services and the RAM allocated by the TCP IP Stack and the WorldFIP pseudo driver Operating system adaptation Describes the adaptation of the TCP IP Stack and the Tool Box module to the operating system TCP IP Sequencer Describes the TCP IP Sequencer module and gives examples for use in a multi task context and a mono task context Device driver adaptation Describes the functions for the adaptation of the device driver and gives some examples for these functions Software startup and stoppage Describes the startup and stoppage procedures of the software For each procedure you will find the inputs outputs and an example Socket functions Describes the socket functions for clients and servers that use stream sockets and for clients and servers that use datagram sockets TCP IP Stack module functions Describes the functions of the TCP IP Stack module with their input and output parameters and gives examples for these functions Processing the real time clock interrupt Example of a stream socket client Example of a stream socket server Example of a datagram socket client Example of a datagram socket server 2 RELATED PUBLICATIONS ALS 50278 ALS 50249 FIP DEVICE MANAGER Software Version 4 User Reference Manual FIP Network general introduction 3 WE WELC
109. ror goto endclient rv recv sock2 rcv_buff 200 0 if rv 1 ALS 53425 a en TCP IP WORLDFIP SUITE Page C 3 Software User Manual Example of a datagram socket client error sockapi_get last_error fprintf fd n SOCK1 recv Error d n error goto endclient else fprintf fd n ECHO Received message for i 0 i lt 10 i fprintf fd x rcv_buff i fprintf fd nin close the connection if sock2 gt 0 rv closesocket sock2 if rv 1 error sockapi_get last_error fprintf fd n SO CK2 close socket Error d n error sock2 0 peer ECHO CLIENT 3 blocking connected datagram without bind sock3 socket PF_INET SOCK_DGRAM 0 if sock3 1 error sockapi_get_last_error fprintf fd n SO CK3 socket Error d n error goto endclient no bind connect the socket remoteaddr3 sin_family AF_INET sockapi_dot2ip rip IP_ST2_ETH memcpy unsigned char amp remoteaddr3 sin_addr unsigned char rip IP_ADDLEN remoteaddr3 sin_port ECHO PORT rv connect sock3 struct sockaddr amp remoteaddr3 sizeof remoteaddr3 if rv 1 error sockapi_get_last_error fprintf fd in SO CK3 connect Error d n error goto endclient Send and Receive for j 32 j lt 48 j for i 0 i lt 100 msgli j i rv send sock3 msg 100 0 if rv 1 error sockapi_get_la
110. rrect address length ESOCKAPI_CONNREFUSED connection refused by the remote machine ESOCKAPI_TIMEDOUT attempt to connect time out without establishing the connection ESOCKAP I_NOMEMORY memory allocation error ESOCKAPI_INTERNALTCP internal error in the TCP layer ESOCKAPI_NOBUFS datagram socket if the number of open datagram sockets is equal to UPPS defined in TCPIP_Stack Configuration tcpipcfg h stream socket if the number of open stream sockets is equal to MAX_ACT_PORTS defined in TCPIP_Stack Configuration tcpipcfg h 6 5 Performance In the case of a datagram socket this function is a non blocking function executed in the context of the user thread or process In the case of a stream socket this function will return at the end of the 3 way handshake protocol used by TCP to establish the connection with the remote station ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 13 Software User Manual Socket functions 7 LISTENO 7 1 Description Servers that open a stream socket use listen to set up a queue of incoming connection requests and to open a passive connection Function syntax include sockapi h int listen int socket int queuelen 7 2 Inputs Socket a socket identifier created by the socket function queuelen number of incoming connection requests This parameter is not used The TCP IP Suite sets up an infinite connection queue the
111. rrors occur then the function returns the total number of characters sent 1 gt error in this case call the function sockapi_get_last_error to get the last error 9 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_INVAL incorrect argument ESOCKAPI_NOTSOCK incorrect socket number ESOCKAP1_NOTCONN the socket is not connected ESOCKAPI_MSGSIZE the message is too large for the socket ESOCKAPI_NOBUFS no more buffers are available in TCP or UDP layer ESOCKAPI_CONNRESET the connection is closed by the remote side ESOCKAPI_MAXRETRANS give up sending the message the message was repeated for the TCP_MAXRETRIES parameter of the TCP layer defined in TCPIP_Stack Configuration tcpipcfg h ESOCKAP1_NOMEMORY memory allocation error ESOCKAPI_INTERNALTCP internal error in the TCP layer 9 5 Performance In the case of a non blocking socket the function will return 1 and a call to the sockapi_get_last_error function will return ESOCKAPI_NOBUFS In the case of a blocking socket and if the socket is a datagram socket the function will not block the user thread or process and it will return 1 and a call to the sockapi_get_last_error function will return
112. ructure defined in SOCKAPI socket h file is used to specify a local or a remote endpoint address to which a socket can be connected In the Internet address family the sockaddr_in structure defined in SOCKAPI in h file is used to store the endpoint address information This structure normally is used to cast the sockaddr type for the functions which require it The value for the sin_family field should be AF_INET The sin_ port field is the port of the endpoint and the sin_addr field is the IP address of the endpoint The last sin_zero field is used to pad the remaining 8 bytes of the endpoint address with the value 0 IPAddr defined in SOCKAPI sockapi h file is a table of IP_ADDLEN characters that defines an IP address ALS 53425 a en TCP IP WORLDFIP SUITE Page 8 5 Software User Manual Socket functions 3 SOCKETO 3 1 Description The socket function allows you to create a socket A socket defines a bi directional endpoint for communication between processes Bi directional implies that an application can transmit and receive data through these connections A socket has three primary components O the interface to which it is bound specified by an IP address the port number to which an application will send or receive data O the type of socket stream or datagram The function returns an identifier for the socket that will be used as a parameter each time that an operation on a socket will be executed By default the
113. s and issues the ECHO ICMP type message After the reception of the ECHO response the TCP IP Stack module calls the user callback function whose address is addr_user_echo_reply this address was set inside the TCP IP Stack module during the call to tcpip_start function or 0 user_echo_resp this address was set inside the TCP IP Stack module during the call to tcpip_echo_rq function In a mono tasking environment or in a multi tasking environment if the user requires a unique ECHO response processing function the user must define the addr_user_echo_reply parameter when the tcpip_start function is called Otherwise this parameter must be null In a multi tasking environment if the user requires a task or process based ECHO response processing function then he must define the user_echo_reply parameter when the tcpip_echo_rq function is called Otherwise this parameter must be null Function syntax include sockapi h tcpip_echo_rq IPaddr dst unsigned short pid unsigned short seg_nb int data_len void user_echo_reply struct ip pip void user_echo_reply struct ip pip 6 2 Input parameters dst destination IP address pid calling process or task identifier seq_nb sequence number enabling the user to match the request with the response data_len length of additional data to transmit in the echo message must be an even number user_echo reply address of a user function that will b
114. s c file oooooonccconccnocccnonnconccconancnnncconnncnncnononnccnncnnnos 4 2 Table 5 1 Sequencer in a mono task context FUNCTIONS eee eeseeceseeeeeeceeeessecereeeneeceeeeenaecereeeneeceeeeenaeeses 5 5 Table 6 1 Elements of the FIP_MSG_INIT Structure cocccccccncnnnononononononononononononononononononononononononononononinonininens 6 5 Page 16 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Chapter Introduction 1 The ALSTOM TCP IP WorldFIP Suite offers users an Internet connection over a WorldFIP network All standard protocols TCP UDP IP ICMP ARP and RARP have been developed with portability in mind so as to be independent of the installation machine s operating system USER f Ethernet driver O Ethernet not provided z driver Figure 1 1 TCP 1P WorldFIP Suite composition ALS 53425 a en TCP IP WORLDFIP SUITE Page 1 1 Software User Manual Introduction The software is delivered as a source code portable to any operating system It has been designed for use in all contexts from real time operating systems on embedded targets to the most common operating system Windows NT UNIX etc The hardware environment should have a programmable timer that produces periodic interrupts The user has to connect the interrupt vector to the interrupt handler This operation depends of the user hardware environment and operating system At the application level the software provid
115. sation of the device driver by the DEV_CONTROL function rcv_buff pointer to a structure whose type depends on the interface type WorldFIP or Ethernet IF driver WorldFIP THEN rcev_buff is a pointer to a structure FIP_PACK defined in the function ELSE IF driver Ethernet THEN rev_buff is a pointer to a structure ETH_PACK defined in the DEV_WRITE function nbytes size of the received packet FIP_PACK or ETH_PACK 2 3 3 Outputs None ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 11 Software User Manual Device driver adaptation 2 4 Examples 2 4 1 Interfacing an Ethernet driver This example shows how to interface the TCP IP Stack with an Ethernet device driver NIF device driver on a Sun station This device driver uses a structure of the ether_packet type defined below as a parameter You have to set this structure in the DEV_WRITE function You have to create the entire eth_rcv_pack function and call it periodically include tcpip h typedef struct ether_addr dest ether_addr src unsigned char type 2 in network byte order unsigned short pktlen length of pktbuf O NLY char pktbuf jether_packet typedef union unsigned char bytes 6 byte order safe initialization a unsigned short shorts 3 force 2 byte alignment Jether_adadr unsigned short eth_if_no void eth_rcv_pack void tcpip_rcvpack unsigned short void unsigned Stress sra DEV_CONTROL I
116. scription The sockapi_start function allows a user to start the SockAPI library services Before starting the SockAPI library services you should start the TCP IP WorldFIP library see ALS 50278 Function syntax include sockapi h int sockapi_start TBX_MEMORY_RN sockapi_memory 2 2 Inputs sockapi_memory pointer to a structure of the TBX_MEMORY_RN type defined in the Tools_Box Tools tbx h file that allows you to define a memory region if the operating system permits this where will be allocated all the resources for this module if the operating system doesn t allow you to define a memory region then this parameter should be set to 0 2 3 Outputs Value Definition 0 OK 1 error in this case call the sockapi_get_last_error function to get the last error 2 4 Fault messages The return value of the sockapi_get_last_error function is ESOCKAPI_ALLREADYINITIALISED it attempts to call the sockapi_start function more than once 2 5 Performance This function is a non blocking function executed in the context of the user thread or process Page 7 14 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage 3 TCPIP_STOP STOPPAGE PROCEDURE OF THE TCP IP STACK MODULE When the user doesn t need to use the TCP IP Stack module anymore he can call the tcpip_ stop function All the resources allocated by the TCP IP Stack module will be freed Before pr
117. sockapi_get_last_error will return ESOCKAPI_NOBUF S The successful completion of sendto does not indicate that the data was successfully delivered Function syntax include sockapi h int sendto int socket char buffer int length int flags struct sockaddr to int tolen Page 8 20 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Socket functions 10 2 Inputs socket a socket identifier created by the socket function buffer buffer containing the data to be transmitted length length of the data in the buffer flags not used to pointer to a sockaddr structure that specifies the peer IP address and the peer port number tolen size of the address structure should be size of sockaddr_in 10 3 Outputs If no errors occur then the function returns the total number of characters sent 1 indicates an error In this case call the function sockapi_get_last_error to get the last error 10 4 Fault messages The returning values of the function sockapi_get_last_error are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_INVAL incorrect argument ESOCKAPI_FAULT incorrect address length ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_MSGSIZE the message is too large for the socket ESOCKAPI_NOBUFS no more buffers are availa
118. st to a structure of the FDM_REF type defined in FIP DEVICE MANAGER User Manual ALS 50278 eth_specific pointer to a structure of the ETH_SPECIFIC type described below that describes the specific parameters of an Ethernet interface if_report return value of the interface initialisation this field is set by the TCP IP Stack module Description of the GENERAL structure typedef struct char if_name unsigned short if_ number IPaddr if_ip_addr int if_ brc_type int if_ mtu IF DEV_TYPE if_dev unsigned short if_arp_policy TBX_MEMORY_RN if_memory FG EN ERAL All the fields of the above structures must be set by the user except the field if_number which will be set by the TCP IP Stack module If you don t know the IP address of an interface you can get it if you call the tcpip getaddr function after the tcpip_start function The RARP mechanism will be started ALS 53425 a en TCP IP WORLDFIP SUITE Page 7 3 Software User Manual Software startup and stoppage if_name pointer to a string that contains the domain name of the interface if number interface number this field is set by the TCP IP Stack module if ip addr point to point IP address if _brc type type of the broadcast address 0 all the bits that represent the host part of the IP address are set to 0 1 all the bits that represent the host part of the IP address are set to 1 if_mtu data link layer messages maximum size Maxi
119. st_error fprintf fd An SO CK3 send Error d n error goto endclient rv recv sock3 rcv_buff 200 0 Page C 4 TCP IP WORLDFIP SUITE Software User Manual ALS 53425 a en Example of a datagram socket client if rv 1 error sockapi_get_last_error fprintf fd n SO CK3 recv Error d n error goto endclient else fprintf fd n ECHO Received message for i 0 i lt 10 i fprintf fd x rcv_bufffi fprintf fd Ann if sock3 gt 0 rv closesocket sock3 if rv 1 error sockapi_get last_error fprintf fd An SO CK3 close socket Error d n error close the connection sock3 0 endclient if sock1 gt 0 rv closesocket sock1 if rv 1 error sockapi_get_last_error fprintf fd An SO CK1 close socket Error d n error sockl 0 if sock2 gt 0 rv closesocket sock2 if rv 1 error sockapi_get_last_error fprintf fd n SO CK2 close socket Error d n error sock2 0 if sock3 gt 0 rv closesocket sock3 if rv 1 error sockapi_get_last_error fprintf fd n SO CK3 close socket Error d n error sock3 0 ALS 53425 a en TCP IP WORLDFIP SUITE Page C 5 Software User Manual Example of a datagram socket client Page C 6 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Appendix Example of a datagram socket server D
120. suspend the task tcpip_tcp_in_fifo_emptyQ Task3 task initialisations while 1 ACQUIRE_SEMAPHORE sem3 suspend the task tcpip_tcp_out_fifo_empty Figure 5 2 Implementation of a sequencer in a multi task context Page 5 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCP IP Sequencer 2 2 Example of a sequencer in a mono task context This example shows you how to implement a sequencer module in a mono task context A timer calls periodically 10 ms the handler_timer function You should complete the following functions of the Tools_Box OS_Adapter tbx_os c file which make non interruptible code sections Function User action tbx_OSInitRegion The user must place in this empty procedure the appropriate call to his operating system for the initialisation of the mechanism for masking the timer interrupts tbx_OSEnterRegion The user must place in this empty procedure the appropriate call to his operating system for the masking of the timer interrupts tbx_OSLeaveRegion The user must place in this empty procedure the appropriate call to his operating system for the unmasking of the timer interrupts tbx_OSDeleteRegion The user must place in this empty procedure the appropriate call to his operating system to release the various resources used for the mechanism of masking the timer interrupts Table 5 1 Sequencer in a mono task context functio
121. t or sometimes called local hardware address of the interface 3 bytes if_brc_hard_addr broadcast hardware address of the interface 3 bytes if_nb_of_rec_buf1 number of reception buffers for the point to point address to be allocated by the WorldFIP device driver Page 7 4 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage if nb of rec _buf2 number of reception buffers for the broadcast address to be allocated by the WorldFIP device driver if msg type WorldFIP messaging type 0 aperiodical messaging periodical messaging if channel_nr channel number 0 in the case of aperiodical messaging 1 to 8 in the case of periodical messaging if_ident identifier of the produced variable in the case of periodical messaging should be set to O in the case of aperiodical messaging addr_user_signal_fip_fatal_error address of a callback function that will be called whenever the WorldFIP device driver detects a communication error addr_user_signal_fip warning address of a callback function that will be called whenever the WorldFIP device driver detects a communication warning Description of the ETH_SPECIFIC structure typedef struct ETH ADDR if station _hard_addr ETH ADDR if brc_hard_addr unsigned short if nb_of_rec_buf unsigned short if size of rec buf JETH_SPECIFIC if station_hard addr point to point or sometimes called local hardware a
122. t function allows the caller to specify the remote endpoint address for a previously created socket If the socket is a stream socket that uses TCP a 3 way handshake protocol to establish the connection will be initiated If the socket is a datagram socket that uses UDP connect only specifies the remote endpoint but does not transfer any datagrams to it Function syntax include sockapi h int connect int socket struct sockaddr remoteaddr int addrlen 6 2 Inputs socket a socket identifier created by the socket function remoteaddr pointer to a sockaddr structure that specifies the remote IP address and the remote port number addrlen size of the address structure should be size of sockaddr_in 6 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error Page 8 12 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 6 4 Fault messages Socket functions The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED ESOCKAPI_FAMILYNOSUPPORT attempts to call a library function without first calling the sockapi_start function if the family is not AF_INET or PF_INET used for the Internet protocol ESOCKAPI_NOTSOCK incorrect socket identifier ESOCKAPI_ISCONN the socket is already connected ESOCKAPI_INVAL incorrect argument remoteaddr ESOCKAPI_FAULT inco
123. t status code d n last_err goto endsrv else fprintf fd nsub socket closesocket O Kin endsrv stat closesocket msock if stat lt 0 fprintf fd nbad close main socket status code d n sockapi_get_last_error else fprintf fd n main socket closesocket O Kin forintf fd n END OF SERVER n int passivesocketTCP unsigned short service int qlen Page B 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Example of a stream socket server return passivesocket service tcp qlen static int passivesocket u_short service char protocol int qlen struct sockaddr_in sin an Internet endpoint address int s type socket descriptor socket type int i bzero char amp sin sizeof sin sin sin_family AF_INET sin sin_addr s addr INADDR ANY sin sin_port service if strcmp protocol udp 0 type SOCK_DGRAM else type SO CK_STREAM allocate socket s socket PF_IN ET type 0 if s lt 0 4 fprintf fd cant create socket reason d n sockapi_get_last_error exit 1 i bina s struct sockaddr amp sin sizeof sin if i lt 0 fprintf fd can t bind the socket to port d reason d n service sockapi_get_last_error exit 1 DE if type SOCK_STREAM amp amp listen s qlen lt 0 fprintf fd can t listen the socket to port d s n service sockapi_get_last_error exit 1
124. ted broadcast is interface number 1 If a workstation is configured as a host there is no problem as there is only one interface if the workstation is configured as a router several interfaces only interface no accepts this broadcasting mode Once this address is obtained the user must enter it into the TCP IP Stack module using the tcpip_putaddr function Function syntax include sockapi h void tcpip_putaddr unsigned short if_number IPaddr ip_addr 2 2 Input parameters if number interface number must be 1 ip_addr IPaddr type array 2 3 Output parameters None ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 3 Software User Manual TCP IP Stack module functions 3 TCPIP_CONF_TARP STATIC CONFIGURATION OF THE IP ADDRESS AND HARDWARE ADDRESS CORRESPONDENCE TABLE 3 1 Description The invocation of the tcpip_conf_tarp function is optional if the user makes this call then the IP address and hardware address correspondence table will be filled in statically This is a way of replacing the ARP mechanism In any case the ARP mechanism works for any IPx address whose lt IPx Addr gt lt hardx Addr gt couple does not exist in the IP address and hardware address correspondence table Function syntax tinclude sockapi h tcpip_conf_tarp unsigned short if_number unsigned short nb_of_couples IP_HARD_COUPLE ip_hard table 3 2 Input parameters if number interface number nb_of_couples
125. tion buffer buffer containing the data to be transmitted length length of the data in the buffer flags not used from pointer to a sockaddr structure recvfrom fills this structure with the peer IP address and the peer port number fromlen size of the address structure Page 8 26 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 12 3 Outputs Socket functions If no errors number of received bytes see recv function for more details 1 error in this case call the sockapi_get_last_error function to get the last error 12 4 Fault messages The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_INVAL incorrect argument ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_NOTCONN the socket is not connected ESOCKAPI_NOBUFS no more buffers are available in UDP layer ESOCKAPI_MSGSIZI El the message is too large for the socket ESOCKAPI_NODATA the socket has no data and the socket was created as non blocking ESOCKAPI_CONNRESET the connection is closed by the remote side ESOCKAPI_OPFORBIDDEN the operation is forbidden ESOCKAP I_NOMEMORY memory allocation error ESOCKAPI_INTERNALTCP internal error in the TCP layer 12 5 Performance
126. tions used by the TCP protocol for the states machine tcpip h contains the include of all the other h files tcpipeth h contains the type definitions used in interfacing with Ethernet tcpipfip h contains the type definitions used in interfacing with WorldFIP tcpipusr h contains the type definitions common to the TCP IP and the user tcpstat h contains the type definitions used by the TCP protocol for the Status Control definition tcptimer h contains the type definitions used by the TCP protocol for time out management udp h contains the type definitions used by the UDP protocol udp_pdrv h contains the type definitions used by the UDP pseudo driver ALS 53425 a en TCP IP WORLDFIP SUITE Page 2 5 Software User Manual General overview of the software e The OS_Adapter directory is composed of the following files Navigation en cours Z TCP la Eg SOANE e tcpipos c tcpipos h adaptation to the operating system the user has to modify these files according to the utilisation context 0 The Device _Driver_Adapter directory is composed of the following files Navigation en cours Z TCP IP TCPI_ Bla E ah e tcpipdrv c tcpipdrv h adaptation to a device driver the user has to modify these files according to the utilisation context miscellaneous files e makefile example of a make file to build the TCP IP library the user has to modify this make file file paths etc
127. tream socket a Server uses the accept function to remove the next connection request from the queue created by the listen function creates a sub socket for the request and returns the identifier of the sub socket The Server will interact with the Client on the new created sub socket Function syntax include sockapi h int accept int socket struct sockaddr remoteaddr int addrlen 8 2 Inputs socket a socket identifier created by the socket function remoteaddr pointer to a sockaddr structure this structure is filled by the accept function with the remote IP address and the remote port number addrlen a pointer that initially specifies the size of the address structure should be size of sockaddr_in and when the call returns specifies the number of bytes of the address structure 8 3 Outputs 0 gt OK 1 gt error in this case call the sockapi_get_last_error function to get the last error Page 8 16 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual 8 4 Fault messages Socket functions The returning values of the sockapi_get_last_error function are Error code Description ESOCKAPI_NOTINITIALISED attempts to call a library function without first calling the sockapi_start function ESOCKAPI_INVAL incorrect argument remoteaddr is 0 ESOCKAPI_NOTSOCK incorrect socket number ESOCKAPI_OPNOTSUPP the socket type does not support accept ESOCKAPI_FAULT incor
128. ts for clients number of passive ports for servers number of passive ports for servers number of accepted connections for each passive port 5 2048 TCP send buffer sizes 4096 TCP receive buffer sizes The size of an TCB descriptor used for each connection is size of the structure tcb see tcb h TCPSBS send buffer size TCPRBS receive buffer size define TCPSBS 2048 TCP send buffer size define TCPRBS 4096 TCP received buffer size define TLPORT 1024 initial TCP local port number allocated by the stack if the user don t specify it define TCP_MAXRETRIES 12 max retransmissions before giving up define TCP_TIMER PERIOD 1 TCP timer period define TCP_MAXPRS define TCP_TWOMSL define TCP_MAXRXT define TCP_MINRXT define TCP_ACKDELAY define BSDURG measured in timer ticks must be 100 milliseconds 600 1 minute Max Persist Time must be a multiple de 100 milliseconds 1200 waiting time before deleting the record of a connection must be 2 Max Segment Lifetime set to 2 minutes must be a multiple de 100 milliseconds 200 20 seconds Max Rexmt Time must be a multiple de 100 milliseconds 5 1 2 second Max Rexmt Time must be a multiple de 100 milliseconds 2 1 5 second ACK delay if TCBF_DELACK must be a multiple de 100 milliseconds TCPIP_NO urgent pointer interpretation TCPIP_NO standard interpretation TCPIP
129. ubnet Mask request Description of the IF_FIP and IF_ETH structures typedef struct unsigned short nb_of_fip_ifs FIP_IF_PARAM potr_tab fip_if param IF_FIP typedef struct unsigned short nb_of_eth_ifs ETH_IF_PARAM otr_tab_eth_if_param HF_ETH nb_of_fip ifs number of WorldFIP interfaces ptr_tab fip if param pointer to an array of pointers to structures of the FIP_IF_PARAM type see below nb_of eth_ifs number of Ethernet interfaces ptr_tab eth_if param pointer to an array of pointers to structures of the ETH_IF_PARAM type see below Description of the FIP_IF_PARAM and ETH_IF_PARAM structures typedef struct GENERAL general FIP_ SPECIFIC fip_ specific void fdm_ref unsigned long if_ report FIP_IF_PARAM typedef struct GENERAL general ETH_SPECIFIC eth_specific unsigned long if_ report JETH_IF_PARAM Page 7 2 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Software startup and stoppage All the fields of the above structures must be set by the user except the field if_report which will be set by the TCP IP Stack module general pointer to a structure of the GENERAL type described below that describes the general parameters of a WorldFIP or Ethernet interface fip specific pointer to a structure of the FIP_SPECIFIC type described below that describes the specific parameters of a WorldFIP interface fdm_ref pointer that should be ca
130. uff 300 short if print the ECHO response len pip gt ip_len copy the bytes pointed by pip in icmp_buff fprintf fd ECHO Reponse In for i 0 i lt len i printf x icmp_buffli printf n ALS 53425 a en TCP IP WORLDFIP SUITE Page 9 13 Software User Manual TCP IP Stack module functions 7 TCPIP_GET_SUBNETMASK GETTING THE SUBNET MASK 7 1 Description To get the subnet mask the user must invoke the tcpip_get_subnetmask function This call addresses the ICMP layer inside the TCP IP Stack module which builds and broadcasts a mask request message Following receipt of the response the TCP IP Stack module calls a user callback function whose address was communicated to the TCP IP Stack module by the parameter adr_user_mask_reply when the tcpip start function was called Function syntax include sockapi h tcpip_get_subnet_mask unsigned short if_number void user_mask_reply struct ip pip 7 2 Input parameters if number interface number 7 3 Output parameters None 7 4 Returned Values Value Description 0 OK 1 if the requested interface is not initialised then it needs to be correctly initialised by the function tcpip_start 2 if there is a system error Page 9 14 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual TCPAP Stack module functions 7 5 Example user_program static void user_mask_rep
131. ver eth_msg_init ETH_MSG_INIT args switch ctrl case INIT_DEV eth_if_no eth_msg_init gt if_number tcpip_rcvpack eth_msg_init gt indication break case STOP_DEV break case FREE MEM_DEV tox_FreeBufferlnPool TBX_USER_BUFFER args break default break else if WO RLDFIP_PSEUDO _DRIVER TCPIP_YES Page 6 16 TCP IP WORLDFIP SUITE ALS 53425 a en Software User Manual Device driver adaptation ALSTOM WorldFIP pseudo driver int rv rv fip_ctri dev ctrl args return rv endif DEV_WRITE IF_DEV_TYPE dev void xmit_buff unsigned nbytes int rv if dev eth_dev_fd ETHERNET driver write the xmit_buff to your specific driver by a write function rv ethernet write free the xmit_buff buffer tox_FreeBufferlnPool TBX_USER_BUFFER xmit_buff return rv else if WO RLDFIP_PSEUDO DRIVER TCPIP_YES ALSTOM WorldFIP pseudo driver rv fip_write dev xmit_buff nbytes return rv endif RRR IIIA AAAI IA AAI AR AAR AIHA A AAR AR AA AAA AAA AAA AAA AAA AA AAA AAA eth_rcv_pack read your specific ETHERNET device driver this function must be called periodically by the user DEK AAA KAA AAA AAA AAA KARA AAA KAA AAA KAA EK AAA KAA EK AAR KAA KK a void eth_rcv_pack ETH_PACK ep struct ip pip ALS 53425 a en TCP IP WORLDFIP SUITE Page 6 17 Software User
Download Pdf Manuals
Related Search
Related Contents
わくわく伝統文化教室 組付・取扱説明書 Samsung HT-C6500 Käyttöopas LabelWriter SE300 User Manual Spec Sheet - Sahara Presentation Systems PLC Copyright © All rights reserved.
Failed to retrieve file