OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
endianconv.h File Reference

Responsible for Endianess conversion. More...

#include "typedefs.h"
Include dependency graph for endianconv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  OpenerEndianess { kOpenerEndianessUnknown = -1, kOpENerEndianessLittle = 0, kOpENerEndianessBig = 1 }
 

Functions

int AddDintToMessage (const EipUint32 data, EipUint8 **const buffer)
 Write an 32Bit integer to the network buffer. More...
 
int AddIntToMessage (const EipUint16 data, EipUint8 **const buffer)
 Write an 16Bit integer to the network buffer. More...
 
int AddSintToMessage (const EipUint8 data, EipUint8 **const buffer)
 converts UINT8 data from host to little endian an writes it to buffer. More...
 
void DetermineEndianess (void)
 Detects Endianess of the platform and sets global g_nOpENerPlatformEndianess variable accordingly. More...
 
int EncapsulateIpAddress (EipUint16 port, EipUint32 address, EipByte **communication_buffer)
 Encapsulate the sockaddr information as necessary for the Common Packet Format data items. More...
 
int FillNextNMessageOctetsWith (CipOctet value, unsigned int n, CipOctet **message)
 
int FillNextNMessageOctetsWithValueAndMoveToNextPosition (CipOctet value, unsigned int n, CipOctet **message)
 
CipByte GetByteFromMessage (const CipOctet **const buffer_address)
 
EipUint32 GetDintFromMessage (const EipUint8 **const buffer)
 Get an 32Bit integer from the network buffer. More...
 
int GetEndianess (void)
 Return the endianess identified on system startup. More...
 
EipUint16 GetIntFromMessage (const EipUint8 **const buffer)
 Get an 16Bit integer from the network buffer, and moves pointer beyond the 16 bit value. More...
 
EipUint8 GetSintFromMessage (const EipUint8 **const buffer)
 Reads EIP_UINT8 from *buffer and converts little endian to host. More...
 
CipUdint GetUdintFromMessage (const CipOctet **const buffer_address)
 
CipUint GetUintFromMessage (const CipOctet **const buffer_address)
 
CipUsint GetUsintFromMessage (const CipOctet **const buffer_address)
 
CipWord GetWordFromMessage (const CipOctet **const buffer_address)
 
int MoveMessageNOctets (const int n, const CipOctet **message_runner)
 

Detailed Description

Responsible for Endianess conversion.

Definition in file endianconv.h.

Enumeration Type Documentation

Enumerator
kOpenerEndianessUnknown 
kOpENerEndianessLittle 
kOpENerEndianessBig 

Definition at line 15 of file endianconv.h.

Function Documentation

void DetermineEndianess ( void  )

Detects Endianess of the platform and sets global g_nOpENerPlatformEndianess variable accordingly.

Identify if we are running on a big or little endian system and set variable.

Detects Endianess of the platform and sets global variable g_nOpENerPlatformEndianess accordingly, whereas 0 equals little endian and 1 equals big endian

Definition at line 239 of file endianconv.c.

References g_opener_platform_endianess, kOpENerEndianessBig, and kOpENerEndianessLittle.

Referenced by EncapsulationInit().

Here is the caller graph for this function:

int EncapsulateIpAddress ( EipUint16  port,
EipUint32  address,
EipByte **  communication_buffer 
)

Encapsulate the sockaddr information as necessary for the Common Packet Format data items.

Converts and adds the provided port and IP address into an common packet format message

Parameters
portPort of the socket, has to be provided in big-endian
addressIP address of the socket, has to be provided in big-endian
communication_bufferThe message buffer for sending the message

Definition at line 197 of file endianconv.c.

References AddDintToMessage(), AddIntToMessage(), g_opener_platform_endianess, kOpENerEndianessBig, and kOpENerEndianessLittle.

Referenced by AssembleLinearMessage(), and EncapsulateListIdentityResponseMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

int FillNextNMessageOctetsWith ( CipOctet  value,
unsigned int  n,
CipOctet **  message 
)

Definition at line 264 of file endianconv.c.

Referenced by FillNextNMessageOctetsWithValueAndMoveToNextPosition().

Here is the caller graph for this function:

int FillNextNMessageOctetsWithValueAndMoveToNextPosition ( CipOctet  value,
unsigned int  n,
CipOctet **  message 
)

Definition at line 271 of file endianconv.c.

References FillNextNMessageOctetsWith(), and MoveMessageNOctets().

Referenced by AssembleLinearMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

CipByte GetByteFromMessage ( const CipOctet **const  buffer_address)

Definition at line 36 of file endianconv.c.

int GetEndianess ( void  )

Return the endianess identified on system startup.

Returns
  • -1 endianess has not been identified up to now
  • 0 little endian system
  • 1 big endian system

Return the endianess identified on system startup.

Returns
0 equals little endian and 1 equals big endian

Definition at line 254 of file endianconv.c.

References g_opener_platform_endianess.

CipUdint GetUdintFromMessage ( const CipOctet **const  buffer_address)

Definition at line 90 of file endianconv.c.

CipUint GetUintFromMessage ( const CipOctet **const  buffer_address)

Definition at line 64 of file endianconv.c.

CipUsint GetUsintFromMessage ( const CipOctet **const  buffer_address)

Definition at line 43 of file endianconv.c.

CipWord GetWordFromMessage ( const CipOctet **const  buffer_address)

Definition at line 71 of file endianconv.c.

int MoveMessageNOctets ( const int  n,
const CipOctet **  message_runner 
)

Definition at line 258 of file endianconv.c.

Referenced by CipEpathEncodeConnectionEpath(), CipEpathGetLogicalValue(), CipEpathSetLogicalValue(), ConnectionObjectInitializeFromMessage(), DetermineDelayTime(), EncapsulateListIdentityResponseMessage(), FillNextNMessageOctetsWithValueAndMoveToNextPosition(), GetElectronicKeyFormat4FromMessage(), and SkipEncapsulationHeader().

Here is the caller graph for this function: