OpENer - Open Source EtherNet/IP(TM) I/O Target Stack
2.1
|
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "endianconv.h"
Go to the source code of this file.
Functions | |
int | AddDintToMessage (const EipUint32 data, EipUint8 **const buffer) |
Converts UINT32 data from host to little endian and writes it to buffer. More... | |
int | AddIntToMessage (const EipUint16 data, EipUint8 **const buffer) |
converts UINT16 data from host to little endian an writes it to 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 () |
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 amount_of_bytes_written, CipOctet **message) |
int | FillNextNMessageOctetsWithValueAndMoveToNextPosition (CipOctet value, unsigned int amount_of_filled_bytes, CipOctet **message) |
CipByte | GetByteFromMessage (const CipOctet **const buffer_address) |
EipUint32 | GetDintFromMessage (const EipUint8 **const buffer) |
Reads EIP_UINT32 from *buffer and converts little endian to host. More... | |
int | GetEndianess () |
Returns global variable g_nOpENerPlatformEndianess, whereas 0 equals little endian and 1 equals big endian. More... | |
EipUint16 | GetIntFromMessage (const EipUint8 **const buffer) |
Reads EIP_UINT16 from *buffer and converts little endian to host. 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 amount_of_bytes_moved, const CipOctet **message_runner) |
Variables | |
OpenerEndianess | g_opener_platform_endianess = kOpenerEndianessUnknown |
void DetermineEndianess | ( | void | ) |
Detects Endianess of the platform and sets global g_nOpENerPlatformEndianess variable accordingly.
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().
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
port | Port of the socket, has to be provided in big-endian |
address | IP address of the socket, has to be provided in big-endian |
communication_buffer | The 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().
int FillNextNMessageOctetsWith | ( | CipOctet | value, |
unsigned int | amount_of_bytes_written, | ||
CipOctet ** | message | ||
) |
Definition at line 264 of file endianconv.c.
Referenced by FillNextNMessageOctetsWithValueAndMoveToNextPosition().
int FillNextNMessageOctetsWithValueAndMoveToNextPosition | ( | CipOctet | value, |
unsigned int | amount_of_filled_bytes, | ||
CipOctet ** | message | ||
) |
Definition at line 271 of file endianconv.c.
References FillNextNMessageOctetsWith(), and MoveMessageNOctets().
Referenced by AssembleLinearMessage().
Definition at line 36 of file endianconv.c.
int GetEndianess | ( | void | ) |
Returns global variable g_nOpENerPlatformEndianess, whereas 0 equals little endian and 1 equals big endian.
Return the endianess identified on system startup.
Definition at line 254 of file endianconv.c.
References g_opener_platform_endianess.
Definition at line 90 of file endianconv.c.
Definition at line 64 of file endianconv.c.
Definition at line 43 of file endianconv.c.
Definition at line 71 of file endianconv.c.
int MoveMessageNOctets | ( | const int | amount_of_bytes_moved, |
const CipOctet ** | message_runner | ||
) |
Definition at line 258 of file endianconv.c.
Referenced by CipEpathEncodeConnectionEpath(), CipEpathGetLogicalValue(), CipEpathSetLogicalValue(), ConnectionObjectInitializeFromMessage(), DetermineDelayTime(), EncapsulateListIdentityResponseMessage(), FillNextNMessageOctetsWithValueAndMoveToNextPosition(), GetElectronicKeyFormat4FromMessage(), and SkipEncapsulationHeader().
OpenerEndianess g_opener_platform_endianess = kOpenerEndianessUnknown |
Definition at line 20 of file endianconv.c.
Referenced by DetermineEndianess(), EncapsulateIpAddress(), and GetEndianess().