📄 pointer.c
字号:
/**************************************************************************
**
** 文件: Pointer.c
** 描述: 该文件完成报文等结构体指针的定义和初始化,
由于接收报文的指针的初始化含有变量,不能直接初始化,通过专门的指针赋值函数赋值
**
**************************************************************************/
//include user defined files
#include "Global_Variable.h"
#include "IP_UDP.h"
#include "EPA_SocMapEnt.h"
#include "EPA_SysManEnt.h"
#include "EPA_AppAccEnt.h"
#include "EPA_ManInfBas.h"
#define S_Offset1 (Send_Buf+sizeof(struct Ether_Header))
#define S_Offset2 (Send_Buf+sizeof(struct Ether_Header)+IP_Header_MinLen)
#define S_Offset3 (Send_Buf+sizeof(struct Ether_Header)+IP_Header_MinLen+UDP_Header_Len)
#define S_Offset4 (Send_Buf+sizeof(struct Ether_Header)+IP_Header_MinLen+UDP_Header_Len+sizeof(struct Service_Header))
#define R_Offset1 (Rece_Buf+sizeof(struct Ether_Header))
#define R_Offset2 (Rece_Buf+sizeof(struct Ether_Header)+IP_Header_Len)
#define R_Offset3 (Rece_Buf+sizeof(struct Ether_Header)+IP_Header_Len+UDP_Header_Len)
#define R_Offset4 (Rece_Buf+sizeof(struct Ether_Header)+IP_Header_Len+UDP_Header_Len+sizeof(struct Service_Header))
//point to Ether header
struct Ether_Header *S_Ehe=(struct Ether_Header *)Send_Buf;
struct Ether_Header *R_Ehe=(struct Ether_Header *)Rece_Buf;
//point to ARP message
struct ARP *S_Arp=(struct ARP *)S_Offset1;
struct ARP *R_Arp=(struct ARP *)R_Offset1;
//point to IP message
struct IP *S_Pip=(struct IP *)S_Offset1;
struct IP *R_Pip=(struct IP *)R_Offset1;
//point to ICMP message
struct ICMP *S_Pic=(struct ICMP *)S_Offset2;
struct ICMP *R_Pic;
//point to UDP message
struct UDP *S_Pdp=(struct UDP *)S_Offset2;
struct UDP *R_Pdp;
//point to NonPeriod Data Annunciation
struct NonPeriodDataAnnunciation *S_Nda=(struct NonPeriodDataAnnunciation *)S_Offset3;
struct NonPeriodDataAnnunciation *R_Nda;
//point to End of NonPeriod Data Sending
struct EndofNonPeriodDataSending *S_End=(struct EndofNonPeriodDataSending *)S_Offset3;
struct EndofNonPeriodDataSending *R_End;
//point to Service header
struct Service_Header *S_She=(struct Service_Header *)S_Offset3;
struct Service_Header *R_She;
//point to Device Annunciation message
struct EM_DeviceAnnunciation *S_SME_Eda=(struct EM_DeviceAnnunciation *)S_Offset4;
struct EM_DeviceAnnunciation *R_SME_Eda;
//point to Clear Device Attribut message
struct EM_ClearDeviceAttribute *S_SME_Cda=(struct EM_ClearDeviceAttribute *)S_Offset4;
struct EM_ClearDeviceAttribute *R_SME_Cda;
//point to Clear Device Attribut Positive Result message
struct EM_ClearDeviceAttribute_Result_Positive *S_SME_Cdp=(struct EM_ClearDeviceAttribute_Result_Positive *)S_Offset4;
struct EM_ClearDeviceAttribute_Result_Positive *R_SME_Cdp;
//point to Set Device Attribute message
struct EM_SetDeviceAttribute *S_SME_Sda=(struct EM_SetDeviceAttribute *)S_Offset4;
struct EM_SetDeviceAttribute *R_SME_Sda;
//point to Set Device Attribute Positive Result message
struct EM_SetDeviceAttribute_Result_Positive *S_SME_Sdp=(struct EM_SetDeviceAttribute_Result_Positive *)S_Offset4;
struct EM_SetDeviceAttribute_Result_Positive *R_SME_Sdp;
//point to Domain Download message
struct DomainDownload *S_AAE_Ddl=(struct DomainDownload *)S_Offset4;
struct DomainDownload *R_AAE_Ddl;
//point to Domain Download Positive Result message
struct DomainDownload_Result_Positive *S_AAE_Ddp=(struct DomainDownload_Result_Positive *)S_Offset4;
struct DomainDownload_Result_Positive *R_AAE_Ddp;
//point to Distribute message
struct Distribute *S_AAE_Dis=(struct Distribute *)S_Offset4;
struct Distribute *R_AAE_Dis;
//point to EPA Device Descriptor Object
struct EPA_Device_Descriptor *MIB_Edd=(struct EPA_Device_Descriptor *)MIB_Buf2;
//point to Max Response Time Object
struct Max_Response_Time *MIB_Mrt=(struct Max_Response_Time *)MIB_Buf4;
//point to Communication Schedule Management Object
struct Communication_Schedule_Management *MIB_Csm=(struct Communication_Schedule_Management *)MIB_Buf5;
//point to Link Object
struct Link_Object *MIB_Lo=(struct Link_Object *)MIB_Buf12;
//point to Configuration
struct Configuration *R_Con=(struct Configuration *)(DomainDownload_Buf+2); //前两个字节是域下载数据的总长度
//point to EPA Socket Mapping Object
struct Socket_Mapping *Som=(struct Socket_Mapping *)Socket_Mapping_Buf;
void Set_R_Pointer(void)
{
R_Pic=(struct ICMP *)R_Offset2;
R_Pdp=(struct UDP *)R_Offset2;
R_Nda=(struct NonPeriodDataAnnunciation *)R_Offset3;
R_End=(struct EndofNonPeriodDataSending *)R_Offset3;
R_She=(struct Service_Header *)R_Offset3;
R_SME_Eda=(struct EM_DeviceAnnunciation *)R_Offset4;
R_SME_Cda=(struct EM_ClearDeviceAttribute *)R_Offset4;
R_SME_Cdp=(struct EM_ClearDeviceAttribute_Result_Positive *)R_Offset4;
R_SME_Sda=(struct EM_SetDeviceAttribute *)R_Offset4;
R_SME_Sdp=(struct EM_SetDeviceAttribute_Result_Positive *)R_Offset4;
R_AAE_Ddl=(struct DomainDownload *)R_Offset4;
R_AAE_Ddp=(struct DomainDownload_Result_Positive *)R_Offset4;
R_AAE_Dis=(struct Distribute *)R_Offset4;
}
/******************* End Of File **********************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -