⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 en_encap.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
📖 第 1 页 / 共 4 页
字号:
**
** Inputs:
**       CB_ComBufType *pComBuf    pointer to Combuf to insert possible tags
**       ECM_SOCK_ADDR *sa         pointer to aocket addresses
**
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_SetSocketAddresses();
**
**---------------------------------------------------------------------------
*/

EXTFUNC void en_cd_SetSocketAddresses( PKTBUF_P msg, ECM_SOCK_ADDR *sa );


/*---------------------------------------------------------------------------
**
** en_cd_AllocMcastAddress()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_AllocMcastAddress();
**
**---------------------------------------------------------------------------
*/

EXTFUNC MCAST_P en_cd_AllocMcastAddress( void );



/*---------------------------------------------------------------------------
**
** en_cd_IFGetConfig()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_IFGetConfig();
**
**---------------------------------------------------------------------------
*/

EXTFUNC INT32 en_cd_IFGetConfig( struct in_addr * psIPAddr,
                                 struct in_addr * psSubnet,
                                 struct in_addr * psBroadCast );



/*---------------------------------------------------------------------------
**
** en_cd_SendEncapCommand()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_SendEncapCommand();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  void en_cd_SendEncapCommand( PKTBUF_P psPktBuf );



/*---------------------------------------------------------------------------
**
** en_cd_ListServicesRequest()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_ListServicesRequest();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  void en_cd_ListServicesRequest( ECE * psEce );



/*---------------------------------------------------------------------------
**
** en_cd_LookupHost()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_LookupHost();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  UINT32 en_cd_LookupHost( UINT8 * pchDestHost, struct in_addr * IP_Server );



/*---------------------------------------------------------------------------
**
** en_cd_HostCompare()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_HostCompare();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  INT32  en_cd_HostCompare( struct sockaddr_in * Key, ECE * HostEntry );



/*---------------------------------------------------------------------------
**
** en_cd_GetOutboundTcpPort()
**
** This function extracts a TCP/IP port from a string.
** A port value is specified using 'C' syntax:
** 0x=hex, 0=octal, isdigit=decimal.
**
** Also range checks the port value.  Port is returned in
** network byte order.
**---------------------------------------------------------------------------
**
** Inputs:
**      UINT8 *cp       string pointer containing port
**       UINT16 *port   pointer to resulting port value
**
** Outputs:
**      UINT16 *port    result of parse
**
** Return
**      OK      Success, *port contains value
**      ERROR   Syntax or range error
**
** Usage:
**    en_cd_GetOutboundTcpPort();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  UINT32 en_cd_GetOutboundTcpPort( UINT8 *cp, UINT16 *port );



/*---------------------------------------------------------------------------
**
** en_cd_GetOutboundAddress()
**
**      This function parses the outbound 'link' address to extract
**      the IP address and optional port address.
**
**      Assumes that the tcpip_address is NULL terminated and storage pointed to by
**      ip_addr is at least as larger as tcpip_address.  Ip_addr is modified
**      regardless of the return value
**
**---------------------------------------------------------------------------
**
** Inputs:
**      UINT8 *tcpip_address    string pointer to address
**      UINT8 *ip_addr          string pointer to place IP address
**      UINT16 *tcp_port        pointer to TCP/IP port value
**
** Outputs:
**      UINT8 *ip_addr          extracted IP address
**       UINT16 *tcp_port       extracted TCP/IP port (optional)
**
** Return
**      OK      Success, ip_addr and tcp_port contain values
**      ERROR   Syntax or range error
**
** Usage:
**      en_cd_GetOutboundAddress();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  INT32 en_cd_GetOutboundAddress( UINT8 *tcpip_address, UINT8 *ip_addr, UINT16 *tcp_port );



/*---------------------------------------------------------------------------
**
** en_cd_MngOutgoingEncapTask()
**
**    Manages the opening and closing of sockets for outgoing encap
**    sessions.  Session management is done in a task separate from
**    the mainline because of the time overhead of DNS lookup,
**    opening a socket, and establishing an ENCAP session with
**    the target.  Generally this task maintains a list all open
**    connections.  Whenever a request is made to a server the
**    binary IP address of the server is resolved, then the list
**    is checked to see if there is an open connection to that
**    server.  If there is an open connection the message is just
**    forwarded to the task that sends the TCP message for the
**    appropriate server.  If there is no open connection a new
**    entry is created in the list and a connection is initiated.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_MngOutgoingEncapTask();
**
**---------------------------------------------------------------------------
*/

EXTFUNC TASKRETURN  en_cd_MngOutgoingEncapTask( TASKPARAM );



/*---------------------------------------------------------------------------
**
** en_cd_PktbufAlloc()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_PktbufAlloc();
**
**---------------------------------------------------------------------------
*/

EXTFUNC PKTBUF_P en_cd_PktbufAlloc( void );



/*---------------------------------------------------------------------------
**
** en_cd_PktbufFree()
**
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_PktbufFree();
**
**---------------------------------------------------------------------------
*/

EXTFUNC void en_cd_PktbufFree( PKTBUF_P psPktbuf );

#define PktBufFree(pktbuf)  en_cd_PktbufFree(pktbuf)

#define PktBufAlloc()  en_cd_PktbufAlloc()

/*---------------------------------------------------------------------------
**
** en_cd_CloseEce()
**
**    This function is called to close a TCP/IP connection and
**    clear the corresponding ENCAP connection endpoint.
**---------------------------------------------------------------------------
**
** Inputs:
**    ECE *psEce     Pointer to structure which describes connection

**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_CloseEce();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  void en_cd_CloseEce( OE_Q_ID OutputQ );



/*---------------------------------------------------------------------------
**
** en_cd_CheckAndGetServices()
**
**  This function is called to parse the reply data in a List Services
**  response and verify that the format is correct and sepcifies the psServices
**  REQUIRED for basic communications.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    void *data                Pointer to ListServices formatted data
**    INT32 lLen                Length of the data
**    ENCAP_SERVICE *psServices Pointer to ENCAP psServices descriptor
**
**
** Outputs:
**    ENCAP_SERVICE *psServices Pointer to ENCAP psServices descriptor (TRUE)
**
**
** Return
**    INT32     TRUE (reply has correct format, supports CIP messaging)
**                    *psServices updated from reply
**              FALSE  (otherwise)
**
** Usage:
**    en_cd_CheckAndGetServices();
**
**---------------------------------------------------------------------------
*/

EXTFUNC  INT32  en_cd_CheckAndGetServices( void *data, INT32 lLen, ENCAP_SERVICE * psServices );



/*---------------------------------------------------------------------------
**
** en_cd_EncapErrorReply()
**
**     This function generates and sends a ENCAP reply message when errors
**     are detected in a received message.
**
**     Assumes that the command, session, and context fields of the
**     ENCAP header are the same as the request message which generated
**     the error.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    PKTBUF_P psPktBuf         Pointer to PKTBUF used for the error message
**    UINT32   nValue           ENCAP error status nValue
**    void    *data             Pointer to optional data to be returned
**    INT32   nDataLen          Length of optional data
**
** Outputs:
**    none
**
** Return
**    none
**
** Usage:
**    en_cd_EncapErrorReply();
**
**---------------------------------------------------------------------------
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -