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

📄 ei_obj.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
** EI_OBJ.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** This module contains the private interfaces for the TCP/IP Interface Object.
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>0----<major>         Customization: <none>0----<major>
**
*****************************************************************************
*****************************************************************************
**
** Services List
** -------------
**
** ei_GetInterfaceConfigAttribute()  - get the InterfaceConfig attributes
** ei_ProcessAppOpen()               - Process an app open message
** ei_ProcessClassRequest()          - Process a request to the object class
** ei_ProcessGetAttrAllClass()       - Get Class Attr All request
** ei_ProcessGetAttrAllInstance()    - Process a Get Attrributes All request
** ei_ProcessGetAttrSingleClass()    - Get Class Attr Single req
** ei_ProcessGetAttrSingleInstance() - Process a Get Attributes Single req
** ei_ProcessInstanceRequest()       - Process a request to object instance 1
** ei_ProcessSetAttrAllInstance()    - Process a Set Attributes All request
** ei_ProcessSetAttrSingleInstance() - Process a Set Attributes Single req
** ei_RestoreCurrentNetworkConfig()  - Obtain the current Network Configuration
** ei_SetConfigControl()             - Set the ConfigControl attribute
** ei_SetHostName()                  - Set the HostName attribute
** ei_SetInterfaceConfig()           - Set the InterfaceConfig attribute
**
*****************************************************************************
*****************************************************************************
**                                                                         **
** ETHERNET/IP EXAMPLE CODE                                                **
** COPYRIGHT (c) 2000-2005 ODVA (Open DeviceNet Vendor Association)		   **
**						   & ControlNet International Ltd.                 **
**                                                                         **
** All rights reserved, except as specifically licensed in writing.        **
** Use of the Ethernet/IP Example Protocol Software is subject to          **
** ODVA's and ControlNet International's Terms of Use Agreement.           **
** The following work constitutes example program code and is intended     **
** merely to illustrate useful programming techniques.  The user is        **
** responsible for applying the code correctly.  The code is provided      **
** AS IS without warranty and is in no way guaranteed to be error-free.    **
**                                                                         **
*****************************************************************************
*****************************************************************************
*/

/****************************************************************************
*****************************************************************************
**
** Change Log
** ----------
**
**  
**
*****************************************************************************
*****************************************************************************
*/

#ifndef EI_OBJ_H
#define EI_OBJ_H


/*
** See if this code is to be included.
*/

#ifdef TCPIP_INTERFACE_OBJECT


/****************************************************************************
**
** Typedefs
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** ei_DataType
**
** Private object data.
**
**---------------------------------------------------------------------------
*/

typedef struct ei_InterfaceConfig
{
   UINT32   lIpAddr;
   UINT32   lSubnetMask;
   UINT32   lGatewayAddr;
   UINT32   lNameServer;
   UINT32   lNameServer_2;
   UINT16   iDomainNameSize;
   UINT8    achDomainName[EI_MAX_DOMAIN_LENGTH];

} 
ei_InterfaceConfig;



typedef struct ei_DataType
{
   UINT32   lInterfaceStatus;
   UINT32   lConfigCapability;
   UINT32   lConfigControl;
   UINT16   iLinkObjPathSize;
   UINT8    achLinkObjPath[EIU_LINK_PATH_LENGTH];

   ei_InterfaceConfig  sInterfaceConfig;

   UINT16   iHostNameSize;
   UINT8    achHostName[EI_MAX_HOST_LENGTH];

}
ei_DataType;


/*---------------------------------------------------------------------------
**
** ei_upsTrrblType
**
** Union of pointers to all tribble types used by the Enet-Tcp/Ip Link object.
** Helps to eliminate those unsightly type casts.
**
**---------------------------------------------------------------------------
*/

typedef union ei_upsTrrblType
{
   GS_TrrblType             *Generic;
   CD_PacketTrrblType       *Packet;
   CM_AppOpenCloseTrrblType *AppOpenClose;
   MR_RegistrationTrrblType *Register;
}
ei_upsTrrblType;



/****************************************************************************
**
** Private data
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** ei_s
**
** Private object data.
**
**---------------------------------------------------------------------------
*/

extern ei_DataType ei_s;



/****************************************************************************
**
** Services
**
*****************************************************************************
*/


/*---------------------------------------------------------------------------
**
** ei_GetInterfaceConfigAttribute()
**
** Get the InterfaceConfig attribute from the combuf.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pComBuf              - Pointer to combuf with details
**
** Outputs:
**    None
**
** Usage:
**    ei_GetInterfaceConfigAttribute( pComBuf );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ei_GetInterfaceConfigAttribute( CB_ComBufType  *pComBuf );




/*---------------------------------------------------------------------------
**
** ei_ProcessAppOpen()
**
** Connection being established.
** Process an app open message from the connection manager.
** Return our yes/no decision on accepting the offer.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    psTrrbl              - Pointer to tribble/combuf with details
**
** Outputs:
**    None
**
** Usage:
**    ei_ProcessAppOpen( psTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ei_ProcessAppOpen( CM_AppOpenCloseTrrblType *psTrrbl );



/*---------------------------------------------------------------------------
**
** ei_ProcessClassRequest()
**
** Process a request packet to object class.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    None
**
** Usage:
**    ei_ProcessClassRequest( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ei_ProcessClassRequest( CD_PacketTrrblType  *pTrrbl );



/*---------------------------------------------------------------------------
**
** ei_ProcessGetAttrAllClass()
**
** Process a packet for Gei_Attrributes_All to class of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessGetAttrAllClass( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessGetAttrAllClass( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_ProcessGetAttrAllInstance()
**
** Process a packet for Gei_Attrributes_All to instance 1 of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessGetAttrAllInstance( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessGetAttrAllInstance( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_ProcessGetAttrSingleClass()
**
** Process a packet for Gei_Attrributes_Single to class of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessGetAttrSingleClass( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessGetAttrSingleClass( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_ProcessGetAttrSingleInstance()
**
** Process a packet for Gei_Attrributes_Single to instance 1 of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessGetAttrSingleInstance( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessGetAttrSingleInstance( CD_PacketTrrblType  *pTrrbl );



/*---------------------------------------------------------------------------
**
** ei_ProcessInstanceRequest()
**
** Process a request packet to instance 1 of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    None
**
**
** Usage:
**    if( ei_ProcessInstanceRequest( pTrrbl ) )...
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ei_ProcessInstanceRequest( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_ProcessSetAttrAllInstance()
**
** Process a packet for Sei_Attrributes_All to instance 1 of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessSetAttrAllInstance( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessSetAttrAllInstance( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_ProcessSetAttrSingleInstance()
**
** Process a packet for Sei_Attrributes_Single to instance 1 of the object.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pTrrbl            - Pointer to request trrbl/combuf
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_ProcessSetAttrSingleInstance( pTrrbl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_ProcessSetAttrSingleInstance( CD_PacketTrrblType  *pTrrbl );


/*---------------------------------------------------------------------------
**
** ei_RestoreCurrentNetworkConfig()
**
** Copy the current Network Configuration to the Private object data.
**
**---------------------------------------------------------------------------
**
** Inputs:
**    none
**
** Outputs:
**    none
**
** Usage:
**    ei_RestoreCurrentNetworkConfig();
**
**---------------------------------------------------------------------------
*/

EXTFUNC void ei_RestoreCurrentNetworkConfig( void );


/*---------------------------------------------------------------------------
**
** ei_SetConfigControl()
**
** validate and set the ConfigControl attribute
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pComBuf           - Pointer to combuf
**    lConfigControl    - ConfigControl value
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_SetConfigControl( pComBuf, lConfigControl );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_SetConfigControl( CB_ComBufType *pComBuf, UINT32  lConfigControl );


/*---------------------------------------------------------------------------
**
** ei_SetHostName()
**
** validate and set the HostName attribute
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pComBuf           - Pointer to combuf
**    piAttribute       - Pointer to HostSize attribute
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_SetHostName( pComBuf, piAttribute );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_SetHostName( CB_ComBufType *pComBuf, UINT16 *piAttribute );

/*---------------------------------------------------------------------------
**
** ei_SetInterfaceConfig()
**
** validate and set the InterfaceConfig attribute
**
**---------------------------------------------------------------------------
**
** Inputs:
**    pComBuf           - Pointer to combuf
**    psEnetConfig      - Pointer to EI_LeEnetConfig
**
** Outputs:
**    Return            - UINT16 iStatus
**
** Usage:
**    iStatus = ei_SetInterfaceConfig( pComBuf, psEnetConfig );
**
**---------------------------------------------------------------------------
*/

EXTFUNC UINT16 ei_SetInterfaceConfig( CB_ComBufType *pComBuf, EI_LeInterfaceConfig *psInterfaceConfig );


#endif  /* #ifdef TCPIP_INTERFACE_OBJECT */
#endif  /* inclusion lock */

/****************************************************************************
**
** End of EI_OBJ.H
**
*****************************************************************************
*/

⌨️ 快捷键说明

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