versadac  1
versadac - Scalable Recorder Firmware
stk_sckt.h
1 /*---------------------------------------------------------------------------*/
2 /* Copyright (C) 2006 Woodhead Software & Electonics. All rights reserved. */
3 /*---------------------------------------------------------------------------*/
4 /* This program is protected by international copyright. */
5 /* */
6 /* The use of this software including but not limited to its Source Code */
7 /* is subject to restrictions as agreed in the license agreement between */
8 /* you and Woodhead. */
9 /* Copying or distribution is not allowed unless expressly permitted */
10 /* according to your license agreement with Woodhead. */
11 /*---------------------------------------------------------------------------*/
12 /* */
13 /* Project : STACK PROFINET Controller */
14 /* Component : Mutex manager */
15 /* $Workfile:: stk_sckt.h $*/
16 /* $Revision:: 3 $*/
17 /* $Date:: 10/08/10 17:33 $*/
18 /* */
19 /*---------------------------------------------------------------------------*/
20 /* */
21 /* D e s c r i p t i o n : */
22 /* abstraction layer for Mutex */
23 /* */
24 /*---------------------------------------------------------------------------*/
25 
26 #ifndef __STK_SCKT_H__
27 #define __STK_SCKT_H__
28 
29 
30 
31 
32 /* Specific defines for pool management*/
33 #define MAXNUM_SOCKETS (10)
34 #define PND_SCKT_FREE 0
35 #define PND_SCKT_USED 1
36 
37 
38 typedef struct _ST_APP_IP_ADDR
39 {
40  union
41  {
42  struct { APP_BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
43  struct { APP_WORD s_w1,s_w2; } S_un_w;
44  APP_DWORD S_addr;
45  } S_un;
47 
48 
49 typedef struct _ST_OS_SOCKADDR_IN
50 {
51  APP_WORD sin_family; /*2 - 0*/
52  APP_WORD sin_port; /*2 - 2*/
53  ST_APP_IP_ADDR sin_addr; /*4 - 4*/
54  APP_BYTE sin_zero[8]; /*8 - 8*/
55 }ST_OS_SOCKADDR_IN, APP_FAR * LPST_OS_SOCKADDR_IN; /* 16*/
56 
57 
58 
59 APP_DWORD StackSockInit (APP_VOID);
60 APP_DWORD StackSockCleanup (APP_VOID);
61 APP_DWORD StackSockOpen (APP_LPDWORD SockId, APP_BYTE bySocketType);
62 APP_DWORD StackSockClose (APP_DWORD SockId, APP_BYTE bySocketType);
63 APP_DWORD StackSockBind (APP_DWORD SockId, LPST_OS_SOCKADDR_IN pSockAdr, APP_DWORD pSockAdrLen);
64 APP_DWORD StackSockListen (APP_DWORD dwSockId,APP_WORD wBack);
65 APP_DWORD StackSockAccept (APP_DWORD dwSockId,APP_WORD wBack);
66 APP_DWORD StackSockReceiveFrom(APP_DWORD dwSockId,APP_LPBYTE pbyBuf,APP_LPWORD pwLen,LPST_OS_SOCKADDR_IN pSockAdr);
67 APP_DWORD StackSockSendTo (APP_DWORD SockId, APP_LPBYTE pBuf, APP_DWORD len, APP_DWORD flags,LPST_OS_SOCKADDR_IN pSockAdr, APP_DWORD SockAdrLen);
68 
69 
70 
71 /* Use to inform if Socket is UDP or TCP one*/
72 #define SOCKET_UDP 0
73 #define SOCKET_TCP 1
74 
75 
76 
77 
78 #endif
Definition: stk_sckt.h:38
Definition: stk_sckt.h:49