Commit d652bcfd authored by Marcus Nordenberg's avatar Marcus Nordenberg

update to correct headers for the new profinet driver

parent 909f529a
...@@ -7,83 +7,82 @@ Phone: ++49-89-4 56 56-0 ...@@ -7,83 +7,82 @@ Phone: ++49-89-4 56 56-0
Fax: ++49-89-4 56 56-3 99 Fax: ++49-89-4 56 56-3 99
http://www.softing.com http://www.softing.com
Copyright (C) SOFTING Industrial Automation GmbH 2005-2013. All Rights Reserved Copyright (C) SOFTING Industrial Automation GmbH 2005-2016. All Rights Reserved
Version: 2.01.00 Version: 2.22.00
******************************************************************************/ ******************************************************************************/
#ifdef __OVERRIDE_GLOBAL_CONFIG_HEADER__
#include __OVERRIDE_GLOBAL_CONFIG_HEADER__
#endif
#ifndef __PNAK_H__ #ifndef __PNAK_H__
#define __PNAK_H__ #define __PNAK_H__
/*****************************************************************************/ /*****************************************************************************/
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#pragma warning(disable : 4103) /* used #pragma pack to change alignment */ #pragma warning (disable : 4103) /* used #pragma pack to change alignment */
#pragma pack(push, 2) #pragma pack (push, 2)
#pragma warning(default : 4103) #pragma warning (default : 4103)
#ifndef PACK_WORD_ALIGNMENT #ifndef PACK_WORD_ALIGNMENT
#define PACK_WORD_ALIGNMENT(Struct) Struct #define PACK_WORD_ALIGNMENT(Struct) Struct
#endif #endif
#ifndef PACK_BYTE_ALIGNMENT #ifndef PACK_BYTE_ALIGNMENT
#define PACK_BYTE_ALIGNMENT(Struct) Struct #define PACK_BYTE_ALIGNMENT(Struct) Struct
#endif #endif
#elif defined __GNUC__ #elif defined __GNUC__
#ifndef PACK_WORD_ALIGNMENT #ifndef PACK_WORD_ALIGNMENT
#define PACK_WORD_ALIGNMENT(Struct) __attribute__((packed, aligned(2))) Struct #define PACK_WORD_ALIGNMENT(Struct) __attribute__ ((packed, aligned (2))) Struct
#endif #endif
#ifndef PACK_BYTE_ALIGNMENT #ifndef PACK_BYTE_ALIGNMENT
#define PACK_BYTE_ALIGNMENT(Struct) __attribute__((packed, aligned(1))) Struct #define PACK_BYTE_ALIGNMENT(Struct) __attribute__ ((packed, aligned (1))) Struct
#endif #endif
#elif defined _OS9000 #elif defined _OS9000
#ifndef PACK_WORD_ALIGNMENT #ifndef PACK_WORD_ALIGNMENT
#define PACK_WORD_ALIGNMENT(Struct) Struct #define PACK_WORD_ALIGNMENT(Struct) Struct
#endif #endif
#ifndef PACK_BYTE_ALIGNMENT #ifndef PACK_BYTE_ALIGNMENT
#define PACK_BYTE_ALIGNMENT(Struct) Struct #define PACK_BYTE_ALIGNMENT(Struct) Struct
#endif #endif
#else #else
#error CAUTION: set word structure alignment #error CAUTION: set word structure alignment
#endif #endif
/****************************************************************************** /******************************************************************************
ACCESS KIT USER INTERFACE ACCESS KIT USER INTERFACE
******************************************************************************/ ******************************************************************************/
#define _BITSET256_RESET_BIT(pBS, BitNr) \ #define _BITSET256_RESET_BIT(pBS,BitNr) (((pBS)) [(BitNr) >> 3] &= ~(1u << ((BitNr) & 7u)))
(((pBS))[(BitNr) >> 3] &= ~(1u << ((BitNr)&7u))) #define _BITSET256_SET_BIT(pBS,BitNr) (((pBS)) [(BitNr) >> 3] |= 1u << ((BitNr) & 7u) )
#define _BITSET256_SET_BIT(pBS, BitNr) \ #define _BITSET256_IS_BIT_SET(pBS,BitNr) ((((pBS)) [(BitNr) >> 3]) & (1u << ((BitNr) & 7u) ))
(((pBS))[(BitNr) >> 3] |= 1u << ((BitNr)&7u))
#define _BITSET256_IS_BIT_SET(pBS, BitNr) \
((((pBS))[(BitNr) >> 3]) & (1u << ((BitNr)&7u)))
#define _BITSET64_RESET_BIT(pBS, BitNr) \ #define _BITSET64_RESET_BIT(pBS,BitNr) (((pBS)) [(BitNr) >> 3] &= ~(1u << ((BitNr) & 7u)))
(((pBS))[(BitNr) >> 3] &= ~(1u << ((BitNr)&7u))) #define _BITSET64_SET_BIT(pBS,BitNr) (((pBS)) [(BitNr) >> 3] |= 1u << ((BitNr) & 7u) )
#define _BITSET64_SET_BIT(pBS, BitNr) \ #define _BITSET64_IS_BIT_SET(pBS,BitNr) ((((pBS)) [(BitNr) >> 3]) & (1u << ((BitNr) & 7u) ))
(((pBS))[(BitNr) >> 3] |= 1u << ((BitNr)&7u))
#define _BITSET64_IS_BIT_SET(pBS, BitNr) \
((((pBS))[(BitNr) >> 3]) & (1u << ((BitNr)&7u)))
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifndef _MAX #ifndef _MAX
#define _MAX(A, B) ((A) > (B) ? (A) : (B)) #define _MAX(A,B) ((A) > (B) ? (A) : (B))
#endif #endif
#ifndef _MIN #ifndef _MIN
#define _MIN(A, B) ((A) < (B) ? (A) : (B)) #define _MIN(A,B) ((A) < (B) ? (A) : (B))
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef enum _T_PNAK_RESULT { typedef enum _T_PNAK_RESULT
PNAK_OK = 0, {
PNAK_OK = 0,
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -155,256 +154,292 @@ typedef enum _T_PNAK_RESULT { ...@@ -155,256 +154,292 @@ typedef enum _T_PNAK_RESULT {
/*--- errors loading library -------------------------------------------*/ /*--- errors loading library -------------------------------------------*/
PNAK_ERR_LIBRARY_NOT_LOADED, PNAK_ERR_LIBRARY_NOT_LOADED,
} T_PNAK_RESULT; } T_PNAK_RESULT;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef unsigned char T_BITSET_256[32]; typedef unsigned char T_BITSET_256 [32];
typedef unsigned char T_BITSET_64[8]; typedef unsigned char T_BITSET_64 [8];
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef unsigned short T_PNAK_EXCEPTION_SOURCE; typedef unsigned short T_PNAK_EXCEPTION_SOURCE;
#define PNAK_EXCEPTION_SOURCE_IS_STACK 0u #define PNAK_EXCEPTION_SOURCE_IS_STACK 0u
#define PNAK_EXCEPTION_SOURCE_IS_PNAK 1u #define PNAK_EXCEPTION_SOURCE_IS_PNAK 1u
#define PNAK_EXCEPTION_SOURCE_IS_APPL 2u #define PNAK_EXCEPTION_SOURCE_IS_APPL 2u
typedef struct _T_PNAK_EXCEPTION { typedef struct _T_PNAK_EXCEPTION
T_PNAK_EXCEPTION_SOURCE Source; {
unsigned short ChannelId; T_PNAK_EXCEPTION_SOURCE Source;
unsigned short ChannelId;
unsigned short ModuleId; unsigned short ModuleId;
unsigned short FileId; unsigned short FileId;
unsigned short ErrorId; unsigned short ErrorId;
PN_U32 UserSpecificParameter; PN_U32 UserSpecificParameter;
char UserString[22]; char UserString [22];
} PACK_WORD_ALIGNMENT(T_PNAK_EXCEPTION); } PACK_WORD_ALIGNMENT (T_PNAK_EXCEPTION);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef unsigned long T_PNAK_OID; typedef unsigned long T_PNAK_OID;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef unsigned short T_PNAK_MODE_ID; typedef unsigned short T_PNAK_MODE_ID;
#define PNAK_UNINITIALIZED_MODE 0 #define PNAK_UNINITIALIZED_MODE 0
#define PNAK_CONTROLLER_MODE 1 #define PNAK_CONTROLLER_MODE 1
#define PNAK_DEVICE_MODE 2 #define PNAK_DEVICE_MODE 2
#define PNAK_SUPERVISOR_MODE 3 #define PNAK_SUPERVISOR_MODE 3
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_VERSION_STRING_LENGTH 42 #define PNAK_VERSION_STRING_LENGTH 42
typedef struct _T_PNAK_VERSION { typedef struct _T_PNAK_VERSION
unsigned short IfId; {
unsigned short HostIfId; unsigned short IfId;
unsigned short HostConfigIfId; unsigned short HostIfId;
unsigned short ExceptionIfId; unsigned short HostConfigIfId;
unsigned short ServiceIfId; unsigned short ExceptionIfId;
unsigned short EventIfId; unsigned short ServiceIfId;
unsigned short StatisticIfId; unsigned short EventIfId;
unsigned short DataIfId; unsigned short StatisticIfId;
unsigned short DataIfId;
char VersionString[PNAK_VERSION_STRING_LENGTH]; char VersionString [PNAK_VERSION_STRING_LENGTH];
} PACK_WORD_ALIGNMENT(T_PNAK_VERSION); } PACK_WORD_ALIGNMENT (T_PNAK_VERSION);
typedef struct _T_PNAK_VERSIONS { typedef struct _T_PNAK_VERSIONS
T_PNAK_VERSION Firmware; {
T_PNAK_VERSION Pnak; T_PNAK_VERSION Firmware;
T_PNAK_VERSION Pnak;
} PACK_WORD_ALIGNMENT(T_PNAK_VERSIONS); } PACK_WORD_ALIGNMENT (T_PNAK_VERSIONS);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_INFINITE_TIMEOUT 0xFFFFFFFFuL #define PNAK_INFINITE_TIMEOUT 0xFFFFFFFFuL
#define PNAK_MAX_NUMBER_WAIT_OBJECTS 32uL #define PNAK_MAX_NUMBER_WAIT_OBJECTS 32uL
typedef PN_U32 T_PNAK_TIMEOUT; typedef PN_U32 T_PNAK_TIMEOUT;
typedef PN_U32 T_PNAK_WAIT_OBJECT; typedef PN_U32 T_PNAK_WAIT_OBJECT;
#define PNAK_WAIT_OBJECT_EXCEPTION ((T_PNAK_WAIT_OBJECT)0x00000001uL) #define PNAK_WAIT_OBJECT_EXCEPTION ((T_PNAK_WAIT_OBJECT) 0x00000001uL)
#define PNAK_WAIT_OBJECT_STATE_CHANGED ((T_PNAK_WAIT_OBJECT)0x00000002uL) #define PNAK_WAIT_OBJECT_STATE_CHANGED ((T_PNAK_WAIT_OBJECT) 0x00000002uL)
#define PNAK_WAIT_OBJECT_ALARM ((T_PNAK_WAIT_OBJECT)0x00000004uL) #define PNAK_WAIT_OBJECT_ALARM ((T_PNAK_WAIT_OBJECT) 0x00000004uL)
#define PNAK_WAIT_OBJECT_ALARM_ACK ((T_PNAK_WAIT_OBJECT)0x00000008uL) #define PNAK_WAIT_OBJECT_ALARM_ACK ((T_PNAK_WAIT_OBJECT) 0x00000008uL)
#define PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED ((T_PNAK_WAIT_OBJECT)0x00000010uL) #define PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED ((T_PNAK_WAIT_OBJECT) 0x00000010uL)
#define PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED \ #define PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED ((T_PNAK_WAIT_OBJECT) 0x00000020uL)
((T_PNAK_WAIT_OBJECT)0x00000020uL) #define PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED ((T_PNAK_WAIT_OBJECT) 0x00000040uL)
#define PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED \ #define PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED ((T_PNAK_WAIT_OBJECT) 0x00000080uL)
((T_PNAK_WAIT_OBJECT)0x00000040uL) #define PNAK_WAIT_OBJECT_SERVICE_IND ((T_PNAK_WAIT_OBJECT) 0x00000100uL)
#define PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED \ #define PNAK_WAIT_OBJECT_SERVICE_CON ((T_PNAK_WAIT_OBJECT) 0x00000200uL)
((T_PNAK_WAIT_OBJECT)0x00000080uL) #define PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED ((T_PNAK_WAIT_OBJECT) 0x00000400uL)
#define PNAK_WAIT_OBJECT_SERVICE_IND ((T_PNAK_WAIT_OBJECT)0x00000100uL) #define PNAK_WAIT_OBJECT_PTCP ((T_PNAK_WAIT_OBJECT) 0x00000800uL)
#define PNAK_WAIT_OBJECT_SERVICE_CON ((T_PNAK_WAIT_OBJECT)0x00000200uL) #define PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED ((T_PNAK_WAIT_OBJECT) 0x00001000uL)
#define PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED \ #define PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED ((T_PNAK_WAIT_OBJECT) 0x00002000uL)
((T_PNAK_WAIT_OBJECT)0x00000400uL) #define PNAK_WAIT_OBJECT_MRPD ((T_PNAK_WAIT_OBJECT) 0x00004000uL)
#define PNAK_WAIT_OBJECT_PTCP ((T_PNAK_WAIT_OBJECT)0x00000800uL) #define PNAK_WAIT_OBJECT_CHANNEL_CLOSED ((T_PNAK_WAIT_OBJECT) 0x00200000uL)
#define PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED ((T_PNAK_WAIT_OBJECT)0x00001000uL) #define PNAK_WAIT_OBJECT_INTERRUPTED ((T_PNAK_WAIT_OBJECT) 0x00400000uL)
#define PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED ((T_PNAK_WAIT_OBJECT)0x00002000uL) #define PNAK_USER_WAIT_OBJECT_1 ((T_PNAK_WAIT_OBJECT) 0x00800000uL)
#define PNAK_WAIT_OBJECT_CHANNEL_CLOSED ((T_PNAK_WAIT_OBJECT)0x00200000uL) #define PNAK_USER_WAIT_OBJECT_2 ((T_PNAK_WAIT_OBJECT) 0x01000000uL)
#define PNAK_WAIT_OBJECT_INTERRUPTED ((T_PNAK_WAIT_OBJECT)0x00400000uL) #define PNAK_USER_WAIT_OBJECT_3 ((T_PNAK_WAIT_OBJECT) 0x02000000uL)
#define PNAK_USER_WAIT_OBJECT_1 ((T_PNAK_WAIT_OBJECT)0x00800000uL) #define PNAK_USER_WAIT_OBJECT_4 ((T_PNAK_WAIT_OBJECT) 0x04000000uL)
#define PNAK_USER_WAIT_OBJECT_2 ((T_PNAK_WAIT_OBJECT)0x01000000uL) #define PNAK_USER_WAIT_OBJECT_5 ((T_PNAK_WAIT_OBJECT) 0x08000000uL)
#define PNAK_USER_WAIT_OBJECT_3 ((T_PNAK_WAIT_OBJECT)0x02000000uL) #define PNAK_USER_WAIT_OBJECT_6 ((T_PNAK_WAIT_OBJECT) 0x10000000uL)
#define PNAK_USER_WAIT_OBJECT_4 ((T_PNAK_WAIT_OBJECT)0x04000000uL) #define PNAK_USER_WAIT_OBJECT_7 ((T_PNAK_WAIT_OBJECT) 0x20000000uL)
#define PNAK_USER_WAIT_OBJECT_5 ((T_PNAK_WAIT_OBJECT)0x08000000uL) #define PNAK_USER_WAIT_OBJECT_8 ((T_PNAK_WAIT_OBJECT) 0x40000000uL)
#define PNAK_USER_WAIT_OBJECT_6 ((T_PNAK_WAIT_OBJECT)0x10000000uL) #define PNAK_WAIT_TIMEOUT ((T_PNAK_WAIT_OBJECT) 0x80000000uL)
#define PNAK_USER_WAIT_OBJECT_7 ((T_PNAK_WAIT_OBJECT)0x20000000uL)
#define PNAK_USER_WAIT_OBJECT_8 ((T_PNAK_WAIT_OBJECT)0x40000000uL) #define PNAK_WAIT_OBJECTS_SERVICE (PNAK_WAIT_OBJECT_SERVICE_CON | \
#define PNAK_WAIT_TIMEOUT ((T_PNAK_WAIT_OBJECT)0x80000000uL) PNAK_WAIT_OBJECT_SERVICE_IND | \
PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED)
#define PNAK_WAIT_OBJECTS_SERVICE \ #define PNAK_WAIT_OBJECTS_EVENT_IND (PNAK_WAIT_OBJECT_STATE_CHANGED | \
(PNAK_WAIT_OBJECT_SERVICE_CON | PNAK_WAIT_OBJECT_SERVICE_IND \ PNAK_WAIT_OBJECT_ALARM | \
| PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED) PNAK_WAIT_OBJECT_ALARM_ACK | \
#define PNAK_WAIT_OBJECTS_EVENT_IND \ PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED | \
(PNAK_WAIT_OBJECT_STATE_CHANGED | PNAK_WAIT_OBJECT_ALARM \ PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED | \
| PNAK_WAIT_OBJECT_ALARM_ACK | PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED \ PNAK_WAIT_OBJECT_PTCP | \
| PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED | PNAK_WAIT_OBJECT_PTCP) PNAK_WAIT_OBJECT_MRPD)
#define PNAK_WAIT_OBJECTS_DATA_IND \ #define PNAK_WAIT_OBJECTS_DATA_IND (PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED |\
(PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED \ PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED)
| PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED) #define PNAK_WAIT_OBJECTS_SOCKET_IND (PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED | \
#define PNAK_WAIT_OBJECTS_SOCKET_IND \ PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED)
(PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED \ #define PNAK_WAIT_OBJECTS_OTHER (PNAK_WAIT_OBJECT_EXCEPTION | \
| PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED) PNAK_WAIT_OBJECT_CHANNEL_CLOSED | \
#define PNAK_WAIT_OBJECTS_OTHER \ PNAK_WAIT_OBJECT_INTERRUPTED)
(PNAK_WAIT_OBJECT_EXCEPTION | PNAK_WAIT_OBJECT_CHANNEL_CLOSED \ #define PNAK_WAIT_OBJECTS_USER (PNAK_USER_WAIT_OBJECT_1 | \
| PNAK_WAIT_OBJECT_INTERRUPTED) PNAK_USER_WAIT_OBJECT_2 | \
#define PNAK_WAIT_OBJECTS_USER \ PNAK_USER_WAIT_OBJECT_3 | \
(PNAK_USER_WAIT_OBJECT_1 | PNAK_USER_WAIT_OBJECT_2 | PNAK_USER_WAIT_OBJECT_3 \ PNAK_USER_WAIT_OBJECT_4 | \
| PNAK_USER_WAIT_OBJECT_4 | PNAK_USER_WAIT_OBJECT_5 \ PNAK_USER_WAIT_OBJECT_5 | \
| PNAK_USER_WAIT_OBJECT_6 | PNAK_USER_WAIT_OBJECT_7 \ PNAK_USER_WAIT_OBJECT_6 | \
| PNAK_USER_WAIT_OBJECT_8) PNAK_USER_WAIT_OBJECT_7 | \
#define PNAK_WAIT_OBJECTS_ALL \ PNAK_USER_WAIT_OBJECT_8)
(PNAK_WAIT_OBJECTS_OTHER | PNAK_WAIT_OBJECTS_EVENT_IND \ #define PNAK_WAIT_OBJECTS_ALL (PNAK_WAIT_OBJECTS_OTHER | \
| PNAK_WAIT_OBJECTS_DATA_IND | PNAK_WAIT_OBJECTS_SERVICE \ PNAK_WAIT_OBJECTS_EVENT_IND | \
| PNAK_WAIT_OBJECTS_SOCKET_IND | PNAK_WAIT_OBJECTS_USER \ PNAK_WAIT_OBJECTS_DATA_IND | \
| PNAK_WAIT_TIMEOUT) PNAK_WAIT_OBJECTS_SERVICE | \
PNAK_WAIT_OBJECTS_SOCKET_IND | \
PNAK_WAIT_OBJECTS_USER | \
PNAK_WAIT_TIMEOUT)
/*---------------------------------------------------------------------------*/
/* now we support only 2 controller-device, 1 configuration in run and
* 1 supervisor-device connection, if we want later
* also support further connections we must increase
* the max number and add specific statemachines in the
* object data structure
*/
#define MAX_NUMBER_CMDEV_CONNECTIONS 4u
/*============================================================================= /*=============================================================================
SERVICE INTERFACE SERVICE INTERFACE
=============================================================================*/ =============================================================================*/
typedef unsigned char T_PNAK_SERVICE_PRIMITIVE; typedef unsigned char T_PNAK_SERVICE_PRIMITIVE;
#define PNAK_SERVICE_REQ (T_PNAK_SERVICE_PRIMITIVE) 0x01u
#define PNAK_SERVICE_RES (T_PNAK_SERVICE_PRIMITIVE) 0x02u
#define PNAK_SERVICE_CON (T_PNAK_SERVICE_PRIMITIVE) 0x03u
#define PNAK_SERVICE_IND (T_PNAK_SERVICE_PRIMITIVE) 0x04u
#define PNAK_SERVICE_REQ (T_PNAK_SERVICE_PRIMITIVE)0x01u typedef unsigned char T_PNAK_SERVICE_RESULT;
#define PNAK_SERVICE_RES (T_PNAK_SERVICE_PRIMITIVE)0x02u
#define PNAK_SERVICE_CON (T_PNAK_SERVICE_PRIMITIVE)0x03u
#define PNAK_SERVICE_IND (T_PNAK_SERVICE_PRIMITIVE)0x04u
typedef unsigned char T_PNAK_SERVICE_RESULT; #define PNAK_RESULT_POS (T_PNAK_SERVICE_RESULT) 0x00u
#define PNAK_RESULT_NEG (T_PNAK_SERVICE_RESULT) 0x01u
#define PNAK_RESULT_POS (T_PNAK_SERVICE_RESULT)0x00u typedef struct _T_PNAK_SERVICE_DESCRIPTION
#define PNAK_RESULT_NEG (T_PNAK_SERVICE_RESULT)0x01u {
unsigned short DeviceRef;
typedef struct _T_PNAK_SERVICE_DESCRIPTION { unsigned char Instance;
unsigned short DeviceRef; unsigned char Service;
unsigned char Instance; T_PNAK_SERVICE_PRIMITIVE Primitive;
unsigned char Service; T_PNAK_SERVICE_RESULT Result;
T_PNAK_SERVICE_PRIMITIVE Primitive; unsigned short ClientId;
T_PNAK_SERVICE_RESULT Result; unsigned short InvokeId;
unsigned short ClientId; unsigned short DataLength;
unsigned short InvokeId;
unsigned short DataLength; } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_DESCRIPTION);
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_DESCRIPTION);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_MAX_NUMBER_REQ_SERVICES 52u #define PNAK_MAX_NUMBER_REQ_SERVICES 52u
#define PNAK_MAX_NUMBER_CON_SERVICES 52u #define PNAK_MAX_NUMBER_CON_SERVICES 52u
#define PNAK_MAX_NUMBER_IND_SERVICES 52u #define PNAK_MAX_NUMBER_IND_SERVICES 52u
#define PNAK_SERVICE_REQ_CHANNEL_SIZE (PN_U16)8086u #ifndef PNAK_SERVICE_REQ_CHANNEL_SIZE
#define PNAK_SERVICE_CON_CHANNEL_SIZE (PN_U16)8086u #define PNAK_SERVICE_REQ_CHANNEL_SIZE (PN_U16) 8086u
#define PNAK_SERVICE_IND_CHANNEL_SIZE (PN_U16)8086u #endif
#ifndef PNAK_SERVICE_CON_CHANNEL_SIZE
#define PNAK_SERVICE_CON_CHANNEL_SIZE (PN_U16) 8086u
#endif
#ifndef PNAK_SERVICE_IND_CHANNEL_SIZE
#define PNAK_SERVICE_IND_CHANNEL_SIZE (PN_U16) 8086u
#endif
/*=== SERVICE REQUEST/RESPONSE ==============================================*/ /*=== SERVICE REQUEST/RESPONSE ==============================================*/
typedef struct _T_PNAK_SERVICE_REQ_RES_ENTRY { typedef struct _T_PNAK_SERVICE_REQ_RES_ENTRY
unsigned short ServiceOffset; {
unsigned short ServiceOffset;
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_REQ_RES_ENTRY); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_REQ_RES_ENTRY);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_SERVICE_REQ_RES { typedef struct _T_PNAK_SERVICE_REQ_RES
unsigned short NumberEntries; {
unsigned short NumberEntries;
T_PNAK_SERVICE_REQ_RES_ENTRY ServiceEntry[PNAK_MAX_NUMBER_REQ_SERVICES]; T_PNAK_SERVICE_REQ_RES_ENTRY ServiceEntry [PNAK_MAX_NUMBER_REQ_SERVICES];
unsigned char ServiceChannel[PNAK_SERVICE_REQ_CHANNEL_SIZE]; unsigned char ServiceChannel [PNAK_SERVICE_REQ_CHANNEL_SIZE];
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_REQ_RES); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_REQ_RES);
/*=== SERVICE CONFIRMATION ==================================================*/ /*=== SERVICE CONFIRMATION ==================================================*/
typedef struct _T_PNAK_SERVICE_CON_ENTRY { typedef struct _T_PNAK_SERVICE_CON_ENTRY
unsigned short ServiceOffset; {
unsigned short ServiceOffset;
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_CON_ENTRY); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_CON_ENTRY);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_SERVICE_CON { typedef struct _T_PNAK_SERVICE_CON
unsigned short NumberEntries; {
unsigned short NumberEntries;
T_PNAK_SERVICE_CON_ENTRY ServiceEntry[PNAK_MAX_NUMBER_CON_SERVICES]; T_PNAK_SERVICE_CON_ENTRY ServiceEntry [PNAK_MAX_NUMBER_CON_SERVICES];
unsigned char ServiceChannel[PNAK_SERVICE_CON_CHANNEL_SIZE]; unsigned char ServiceChannel [PNAK_SERVICE_CON_CHANNEL_SIZE];
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_CON); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_CON);
/*=== SERVICE INDICATION ====================================================*/ /*=== SERVICE INDICATION ====================================================*/
typedef struct _T_PNAK_SERVICE_IND_ENTRY { typedef struct _T_PNAK_SERVICE_IND_ENTRY
unsigned short ServiceOffset; {
unsigned short ServiceOffset;
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_IND_ENTRY); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_IND_ENTRY);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_SERVICE_IND { typedef struct _T_PNAK_SERVICE_IND
unsigned short NumberEntries; {
unsigned short NumberEntries;
T_PNAK_SERVICE_IND_ENTRY ServiceEntry[PNAK_MAX_NUMBER_IND_SERVICES]; T_PNAK_SERVICE_IND_ENTRY ServiceEntry [PNAK_MAX_NUMBER_IND_SERVICES];
unsigned char ServiceChannel[PNAK_SERVICE_IND_CHANNEL_SIZE]; unsigned char ServiceChannel [PNAK_SERVICE_IND_CHANNEL_SIZE];
} PACK_WORD_ALIGNMENT(T_PNAK_SERVICE_IND); } PACK_WORD_ALIGNMENT (T_PNAK_SERVICE_IND);
/*============================================================================= /*=============================================================================
EVENT INTERFACE EVENT INTERFACE
=============================================================================*/ =============================================================================*/
typedef unsigned short T_PNAK_MODE; typedef unsigned short T_PNAK_MODE;
#define PNAK_MODE_OFFLINE (T_PNAK_MODE)0u #define PNAK_MODE_OFFLINE (T_PNAK_MODE) 0u
#define PNAK_MODE_ONLINE (T_PNAK_MODE)1u #define PNAK_MODE_ONLINE (T_PNAK_MODE) 1u
/*=== EVENT REQUEST ==========================================================*/ /*=== EVENT REQUEST ==========================================================*/
typedef struct _T_PNAK_EVENT_SET_MODE { typedef struct _T_PNAK_EVENT_SET_MODE
T_PNAK_MODE Mode; {
T_PNAK_MODE Mode;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_SET_MODE); } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_SET_MODE);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_EVENT_SET_DEVICE_STATE { typedef struct _T_PNAK_EVENT_SET_DEVICE_STATE
T_BITSET_256 ActivateDeviceReference; {
T_BITSET_256 DeactivateDeviceReference; T_BITSET_256 ActivateDeviceReference;
T_BITSET_256 DeactivateDeviceReference;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_SET_DEVICE_STATE); } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_SET_DEVICE_STATE);
/*=== EVENT INDICATION ======================================================*/ /*=== EVENT INDICATION ======================================================*/
typedef enum _T_PNAK_STATE { typedef enum _T_PNAK_STATE
{
PNAK_STATE_OK = 0, PNAK_STATE_OK = 0,
PNAK_STATE_NO_PARAMETER, PNAK_STATE_NO_PARAMETER,
PNAK_STATE_DOUBLE_ADDRESS_ERROR, PNAK_STATE_DOUBLE_ADDRESS_ERROR,
...@@ -420,263 +455,298 @@ typedef enum _T_PNAK_STATE { ...@@ -420,263 +455,298 @@ typedef enum _T_PNAK_STATE {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_EVENT_STATE { typedef struct _T_PNAK_EVENT_STATE
T_PNAK_MODE Mode; {
T_PNAK_STATE State; T_PNAK_MODE Mode;
T_PNAK_STATE State;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_STATE); } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_STATE);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_EVENT_ALARM { typedef struct _T_PNAK_EVENT_ALARM
T_BITSET_256 DeviceReference; {
T_BITSET_256 DeviceReference;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_ALARM); } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_ALARM);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_EVENT_ALARM_ACK { typedef struct _T_PNAK_EVENT_ALARM_ACK
T_BITSET_256 DeviceReference; {
T_BITSET_256 DeviceReference;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_ALARM_ACK); } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_ALARM_ACK);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_DEVICE_STATE_DEACTIVATED 0x00u #define PNAK_DEVICE_STATE_DEACTIVATED 0x00u
#define PNAK_DEVICE_STATE_FIND_DEVICE 0x01u #define PNAK_DEVICE_STATE_FIND_DEVICE 0x01u
#define PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT 0x02u #define PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT 0x02u
#define PNAK_DEVICE_STATE_CONNECTED 0x04u #define PNAK_DEVICE_STATE_CONNECTED 0x04u
#define PNAK_DEVICE_STATE_CONNECT_ERROR 0x10u #define PNAK_DEVICE_STATE_CONNECT_ERROR 0x10u
#define PNAK_DEVICE_STATE_WRITE_ERROR 0x20u #define PNAK_DEVICE_STATE_WRITE_ERROR 0x20u
#define PNAK_DEVICE_STATE_CONTROL_ERROR 0x40u #define PNAK_DEVICE_STATE_CONTROL_ERROR 0x40u
#define PNAK_DEVICE_STATE_CLOSE_PENDING 0x80u #define PNAK_DEVICE_STATE_CLOSE_PENDING 0x80u
#define PNAK_DEVICE_STATE_ERROR_MASK \ #define PNAK_DEVICE_STATE_MASK (PNAK_DEVICE_STATE_DEACTIVATED | \
(PNAK_DEVICE_STATE_CONNECT_ERROR | PNAK_DEVICE_STATE_WRITE_ERROR \ PNAK_DEVICE_STATE_FIND_DEVICE | \
| PNAK_DEVICE_STATE_CONTROL_ERROR) PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT | \
PNAK_DEVICE_STATE_CONNECTED)
#define PNAK_DEVICE_STATE_MASK_CONNECTING (PNAK_DEVICE_STATE_FIND_DEVICE | \
PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT)
#define PNAK_DEVICE_STATE_ERROR_MASK (PNAK_DEVICE_STATE_CONNECT_ERROR | \
PNAK_DEVICE_STATE_WRITE_ERROR | \
PNAK_DEVICE_STATE_CONTROL_ERROR)
typedef struct _T_PNAK_EVENT_DEVICE_STATE
{
unsigned char State [MAX_NUMBER_SUPPORTED_DEVICES];
} PACK_WORD_ALIGNMENT (T_PNAK_EVENT_DEVICE_STATE);
typedef struct _T_PNAK_EVENT_DEVICE_STATE { /*---------------------------------------------------------------------------*/
unsigned char State[MAX_NUMBER_SUPPORTED_DEVICES];
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_DEVICE_STATE); #define PNAK_PTCP_IN_SNYC 0x00000001uL
#define PNAK_PTCP_NO_SYNC_MESSAGE 0x00000002uL
#define PNAK_PTCP_JITTER_OUT_OF_BOUNDARY 0x00000004uL
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_PTCP_IN_SNYC 0x00000001uL #define PNAK_MRPD_MISSING_APPEARS 0x8000u
#define PNAK_PTCP_NO_SYNC_MESSAGE 0x00000002uL #define PNAK_MRPD_MISSING_DISAPPEARS 0x0000u
#define PNAK_PTCP_JITTER_OUT_OF_BOUNDARY 0x00000004uL
/*=== EVENT INDICATION MASK =================================================*/ typedef struct _T_PNAK_EVENT_MRPD_IOCR
{
PN_U16 FrameId [PN_SERVICE_DOWNLOAD_MAX_NUMBER_IOCRS];
} PACK_WORD_ALIGNMENT (T_PNAK_EVENT_MRPD_IOCR);
#define PNAK_EVENT_STATE_CHANGED 0x00000001uL typedef struct _T_PNAK_EVENT_MRPD
#define PNAK_EVENT_DEVICE_STATE_CHANGED 0x00000002uL {
#define PNAK_EVENT_ALARM 0x00000004uL T_PNAK_EVENT_MRPD_IOCR AR [MAX_NUMBER_CMDEV_CONNECTIONS];
#define PNAK_EVENT_ALARM_ACK 0x00000008uL
#define PNAK_EVENT_ETHERNET_STATE_CHANGED 0x00000010uL
#define PNAK_EVENT_PTCP 0x00000020uL
#define PNAK_EVENT_MASK \
(PNAK_EVENT_STATE_CHANGED | PNAK_EVENT_DEVICE_STATE_CHANGED \
| PNAK_EVENT_ALARM | PNAK_EVENT_ALARM_ACK \
| PNAK_EVENT_ETHERNET_STATE_CHANGED | PNAK_EVENT_PTCP)
typedef PN_U32 T_PNAK_EVENT_REG; } PACK_WORD_ALIGNMENT (T_PNAK_EVENT_MRPD);
typedef struct _T_PNAK_EVENT_IND_MASK { /*=== EVENT INDICATION MASK =================================================*/
T_PNAK_EVENT_REG EventMaskReg;
} PACK_WORD_ALIGNMENT(T_PNAK_EVENT_IND_MASK); #define PNAK_EVENT_STATE_CHANGED 0x00000001uL
#define PNAK_EVENT_DEVICE_STATE_CHANGED 0x00000002uL
#define PNAK_EVENT_ALARM 0x00000004uL
#define PNAK_EVENT_ALARM_ACK 0x00000008uL
#define PNAK_EVENT_ETHERNET_STATE_CHANGED 0x00000010uL
#define PNAK_EVENT_PTCP 0x00000020uL
#define PNAK_EVENT_MRPD 0x00000040uL
#define PNAK_EVENT_MASK (PNAK_EVENT_STATE_CHANGED | \
PNAK_EVENT_DEVICE_STATE_CHANGED | \
PNAK_EVENT_ALARM | \
PNAK_EVENT_ALARM_ACK | \
PNAK_EVENT_ETHERNET_STATE_CHANGED | \
PNAK_EVENT_PTCP | \
PNAK_EVENT_MRPD)
typedef PN_U32 T_PNAK_EVENT_REG;
typedef struct _T_PNAK_EVENT_IND_MASK
{
T_PNAK_EVENT_REG EventMaskReg;
} PACK_WORD_ALIGNMENT (T_PNAK_EVENT_IND_MASK);
/*============================================================================= /*=============================================================================
STATISTIC INTERFACE STATISTIC INTERFACE
=============================================================================*/ =============================================================================*/
/* Attention: keep in sync with data provided by stack, see controller context /* Attention: keep in sync with data provided by stack, see controller/device context management */
* management */ #define PNAK_CMCTL_VENDOR_ID_MISMATCH 0x00000001uL
#define PNAK_CMCTL_VENDOR_ID_MISMATCH 0x00000001uL #define PNAK_CMCTL_DEVICE_ID_MISMATCH 0x00000002uL
#define PNAK_CMCTL_DEVICE_ID_MISMATCH 0x00000002uL #define PNAK_CMCTL_DUPLICATE_NAME 0x00000004uL
#define PNAK_CMCTL_DUPLICATE_NAME 0x00000004uL #define PNAK_CMCTL_DUPLICATE_IP_ADDRESS 0x00000008uL
#define PNAK_CMCTL_DUPLICATE_IP_ADDRESS 0x00000008uL #define PNAK_CMCTL_NO_EMPTY_NAME 0x00000010uL
#define PNAK_CMCTL_NO_EMPTY_NAME 0x00000010uL #define PNAK_CMCTL_RPC_RESPONSE_MISSING 0x00000020uL
#define PNAK_CMCTL_RPC_RESPONSE_MISSING 0x00000020uL #define PNAK_CMCTL_MODULE_MISMATCH 0x00000040uL
#define PNAK_CMCTL_MODULE_MISMATCH 0x00000040uL
#define PNIO_STATUS_CODING_RPC 0x00000001uL
#define PNIO_STATUS_CODING_NDR 0x00000002uL
#define PNIO_STATUS_CODING_PROFINET 0x00000003uL
#define PNIO_STATUS_ENCODING_BIG_ENDIAN 0x00u
#define PNIO_STATUS_ENCODING_LITTLE_ENDIAN 0x10u
#define PNIO_STATUS_ENCODING_MASK 0xF0u
typedef struct _T_PNAK_CONNECTION_STATISTIC
{
PN_U32 Coding;
PN_U8 Encoding;
PN_U8 Reserved [3];
typedef struct _T_PNAK_CMCTL_STATISTIC { T_PROFINET_STATUS PNIOStatus;
PN_U32 NumberDevicesInStartup;
PN_U32 NumberDevicesConnected;
T_PN_MAC_ADDRESS MacAddress[MAX_NUMBER_SUPPORTED_DEVICES]; } T_PNAK_CONNECTION_STATISTIC;
T_PROFINET_STATUS PNIOStatus[MAX_NUMBER_SUPPORTED_DEVICES]; typedef struct _T_PNAK_CMCTL_STATISTIC
PN_U32 Status[MAX_NUMBER_SUPPORTED_DEVICES]; {
PN_U32 NumberDevicesInStartup;
PN_U32 NumberDevicesConnected;
T_PN_MAC_ADDRESS MacAddress [MAX_NUMBER_SUPPORTED_DEVICES];
T_PNAK_CONNECTION_STATISTIC Cmctl [MAX_NUMBER_SUPPORTED_DEVICES];
PN_U32 Status [MAX_NUMBER_SUPPORTED_DEVICES];
} T_PNAK_CMCTL_STATISTIC; } T_PNAK_CMCTL_STATISTIC;
/*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_CMDEV_STATISTIC
{
T_PNAK_CONNECTION_STATISTIC Cmdev [MAX_NUMBER_CMDEV_CONNECTIONS];
} T_PNAK_CMDEV_STATISTIC;
/*============================================================================= /*=============================================================================
DATA INTERFACE DATA INTERFACE
=============================================================================*/ =============================================================================*/
/*=== DATA INDICATION =======================================================*/ /*=== DATA INDICATION =======================================================*/
typedef struct _T_PNAK_DATA_CONSUMER_DATA_CHANGED { typedef struct _T_PNAK_DATA_CONSUMER_DATA_CHANGED
T_BITSET_256 DeviceReference; {
T_BITSET_256 DeviceReference;
} PACK_WORD_ALIGNMENT(T_PNAK_DATA_CONSUMER_DATA_CHANGED); } PACK_WORD_ALIGNMENT (T_PNAK_DATA_CONSUMER_DATA_CHANGED);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef struct _T_PNAK_DATA_PROVIDER_DATA_UPDATED { typedef struct _T_PNAK_DATA_PROVIDER_DATA_UPDATED
T_BITSET_256 DeviceReference; {
T_BITSET_256 DeviceReference;
} PACK_WORD_ALIGNMENT(T_PNAK_DATA_PROVIDER_DATA_UPDATED); } PACK_WORD_ALIGNMENT (T_PNAK_DATA_PROVIDER_DATA_UPDATED);
/*=== DATA INDICATION MASK ==================================================*/ /*=== DATA INDICATION MASK ==================================================*/
#define PNAK_DATA_EVENT_CYCLIC_TRANSFER_FINISHED 0x00000001uL #define PNAK_DATA_EVENT_CYCLIC_TRANSFER_FINISHED 0x00000001uL
#define PNAK_DATA_EVENT_CONSUMER_DATA_CHANGED 0x00000002uL #define PNAK_DATA_EVENT_CONSUMER_DATA_CHANGED 0x00000002uL
#define PNAK_DATA_EVENT_PROVIDER_DATA_UPDATED 0x00000004uL #define PNAK_DATA_EVENT_PROVIDER_DATA_UPDATED 0x00000004uL
typedef PN_U32 T_PNAK_DATA_EVENT_REG; typedef PN_U32 T_PNAK_DATA_EVENT_REG;
typedef struct _T_PNAK_DATA_IND_MASK { typedef struct _T_PNAK_DATA_IND_MASK
T_PNAK_DATA_EVENT_REG EventMaskReg; {
T_PNAK_DATA_EVENT_REG EventMaskReg;
} PACK_WORD_ALIGNMENT(T_PNAK_DATA_IND_MASK); } PACK_WORD_ALIGNMENT (T_PNAK_DATA_IND_MASK);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define PNAK_IOXS_STATUS_NO_EXTENTION_FOLLOWS 0x00u #define PNAK_IOXS_STATUS_NO_EXTENTION_FOLLOWS 0x00u
#define PNAK_IOXS_STATUS_DETECTED_BY_SUBSLOT 0x00u #define PNAK_IOXS_STATUS_DETECTED_BY_SUBSLOT 0x00u
#define PNAK_IOXS_STATUS_DETECTED_BY_SLOT 0x20u #define PNAK_IOXS_STATUS_DETECTED_BY_SLOT 0x20u
#define PNAK_IOXS_STATUS_DETECTED_BY_DEVICE 0x40u #define PNAK_IOXS_STATUS_DETECTED_BY_DEVICE 0x40u
#define PNAK_IOXS_STATUS_DETECTED_BY_CONTROLLER 0x60u #define PNAK_IOXS_STATUS_DETECTED_BY_CONTROLLER 0x60u
#define PNAK_IOXS_STATUS_DATA_BAD 0x00u #define PNAK_IOXS_STATUS_DATA_BAD 0x00u
#define PNAK_IOXS_STATUS_DATA_GOOD 0x80u #define PNAK_IOXS_STATUS_DATA_GOOD 0x80u
/*---------------------------------------------------------------------------*/
/* now we support only 2 controller-device, 1 configuration in run and
* 1 supervisor-device connection, if we want later
* also support further connections we must increase
* the max number and add specific statemachines in the
* object data structure
*/
#define MAX_NUMBER_CMDEV_CONNECTIONS 4u
/****************************************************************************** /******************************************************************************
FUNCTION DECLARATION FUNCTION DECLARATION
******************************************************************************/ ******************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef __DOXYGEN__ #ifndef __DOXYGEN__
/*--- initialization/termination functions ----------------------------------*/ /*--- initialization/termination functions ----------------------------------*/
extern void pnak_init(void); extern void pnak_init (void);
extern void pnak_term(void); extern void pnak_term (void);
#define pnak_start_profistack pnak_start_stack #define pnak_start_profistack pnak_start_stack
#define pnak_stop_profistack pnak_stop_stack #define pnak_stop_profistack pnak_stop_stack
extern T_PNAK_RESULT pnak_start_stack(unsigned short, const T_PNAK_MODE_ID); extern T_PNAK_RESULT pnak_start_stack (unsigned short, const T_PNAK_MODE_ID);
extern T_PNAK_RESULT pnak_stop_stack(unsigned short); extern T_PNAK_RESULT pnak_stop_stack (unsigned short);
/*--- General interface functions -------------------------------------------*/ /*--- General interface functions -------------------------------------------*/
extern T_PNAK_RESULT pnak_wait_for_multiple_objects( extern T_PNAK_RESULT pnak_wait_for_multiple_objects (unsigned short, T_PNAK_WAIT_OBJECT*, T_PNAK_TIMEOUT);
unsigned short, T_PNAK_WAIT_OBJECT*, T_PNAK_TIMEOUT); extern T_PNAK_RESULT pnak_set_multiple_objects (unsigned short, const T_PNAK_WAIT_OBJECT);
extern T_PNAK_RESULT pnak_set_multiple_objects( extern T_PNAK_RESULT pnak_mask_multiple_objects (unsigned short, const T_PNAK_WAIT_OBJECT);
unsigned short, const T_PNAK_WAIT_OBJECT);
extern T_PNAK_RESULT pnak_mask_multiple_objects(
unsigned short, const T_PNAK_WAIT_OBJECT);
extern T_PNAK_RESULT pnak_get_exception(unsigned short, T_PNAK_EXCEPTION*); extern T_PNAK_RESULT pnak_get_exception (unsigned short, T_PNAK_EXCEPTION*);
extern T_PNAK_RESULT pnak_get_version(unsigned short, T_PNAK_VERSIONS*); extern T_PNAK_RESULT pnak_get_version (unsigned short, T_PNAK_VERSIONS*);
extern T_PNAK_RESULT pnak_snmp_get_data(unsigned short, T_PNAK_OID*, void*, extern T_PNAK_RESULT pnak_snmp_get_data (unsigned short, T_PNAK_OID*, void*, PN_U32*, PN_U32*, unsigned char, PN_BOOL);
PN_U32*, PN_U32*, unsigned char, PN_BOOL); extern T_PNAK_RESULT pnak_snmp_check_data (unsigned short, T_PNAK_OID*, void*, PN_U32, PN_U32, unsigned char);
extern T_PNAK_RESULT pnak_snmp_check_data( extern T_PNAK_RESULT pnak_snmp_set_data (unsigned short, T_PNAK_OID*, void*, PN_U32, PN_U32);
unsigned short, T_PNAK_OID*, void*, PN_U32, PN_U32, unsigned char);
extern T_PNAK_RESULT pnak_snmp_set_data(
unsigned short, T_PNAK_OID*, void*, PN_U32, PN_U32);
extern T_PNAK_RESULT pnak_retrigger_watchdog(unsigned short, PN_U32); extern T_PNAK_RESULT pnak_retrigger_watchdog (unsigned short, PN_U32);
/*--- Service interface functions -------------------------------------------*/ /*--- Service interface functions -------------------------------------------*/
extern T_PNAK_RESULT pnak_limit_number_parallel_services( extern T_PNAK_RESULT pnak_limit_number_parallel_services (unsigned short, unsigned short, unsigned short);
unsigned short, unsigned short, unsigned short);
extern T_PNAK_RESULT pnak_send_service_req_res( extern T_PNAK_RESULT pnak_send_service_req_res (unsigned short, const T_PNAK_SERVICE_REQ_RES*);
unsigned short, const T_PNAK_SERVICE_REQ_RES*); extern T_PNAK_RESULT pnak_get_service_ind (unsigned short, T_PNAK_SERVICE_IND*);
extern T_PNAK_RESULT pnak_get_service_ind(unsigned short, T_PNAK_SERVICE_IND*); extern T_PNAK_RESULT pnak_get_service_con (unsigned short, T_PNAK_SERVICE_CON*);
extern T_PNAK_RESULT pnak_get_service_con(unsigned short, T_PNAK_SERVICE_CON*);
/*--- Event interface functions ---------------------------------------------*/ /*--- Event interface functions ---------------------------------------------*/
extern T_PNAK_RESULT pnak_set_mode( extern T_PNAK_RESULT pnak_set_mode (unsigned short, const T_PNAK_EVENT_SET_MODE*);
unsigned short, const T_PNAK_EVENT_SET_MODE*); extern T_PNAK_RESULT pnak_set_device_state (unsigned short, const T_PNAK_EVENT_SET_DEVICE_STATE*);
extern T_PNAK_RESULT pnak_set_device_state(
unsigned short, const T_PNAK_EVENT_SET_DEVICE_STATE*);
extern T_PNAK_RESULT pnak_get_state(unsigned short, T_PNAK_EVENT_STATE*); extern T_PNAK_RESULT pnak_get_state (unsigned short, T_PNAK_EVENT_STATE*);
extern T_PNAK_RESULT pnak_get_device_state_ind( extern T_PNAK_RESULT pnak_get_device_state_ind (unsigned short, T_PNAK_EVENT_DEVICE_STATE*);
unsigned short, T_PNAK_EVENT_DEVICE_STATE*); extern T_PNAK_RESULT pnak_get_alarm_ind (unsigned short, T_PNAK_EVENT_ALARM*);
extern T_PNAK_RESULT pnak_get_alarm_ind(unsigned short, T_PNAK_EVENT_ALARM*); extern T_PNAK_RESULT pnak_get_alarm_ack_ind (unsigned short, T_PNAK_EVENT_ALARM_ACK*);
extern T_PNAK_RESULT pnak_get_alarm_ack_ind( extern T_PNAK_RESULT pnak_get_ptcp_ind (unsigned short, PN_U32*);
unsigned short, T_PNAK_EVENT_ALARM_ACK*); extern T_PNAK_RESULT pnak_get_mrpd_ind (unsigned short, T_PNAK_EVENT_MRPD*);
extern T_PNAK_RESULT pnak_get_ptcp_ind(unsigned short, PN_U32*);
/*--- Data interface functions ----------------------------------------------*/ /*--- Data interface functions ----------------------------------------------*/
extern T_PNAK_RESULT pnak_set_iocr_data(unsigned short, unsigned short, extern T_PNAK_RESULT pnak_set_iocr_data (unsigned short, unsigned short, const unsigned char*, unsigned short, unsigned char);
const unsigned char*, unsigned short, unsigned char);
extern T_PNAK_RESULT pnak_get_iocr_data(unsigned short, unsigned short, extern T_PNAK_RESULT pnak_get_iocr_data (unsigned short, unsigned short, unsigned char*, unsigned short*, unsigned char*, unsigned char*);
unsigned char*, unsigned short*, unsigned char*, unsigned char*); extern T_PNAK_RESULT pnak_get_consumer_data_changed_ind (unsigned short, T_PNAK_DATA_CONSUMER_DATA_CHANGED*);
extern T_PNAK_RESULT pnak_get_consumer_data_changed_ind( extern T_PNAK_RESULT pnak_get_provider_data_updated (unsigned short, T_PNAK_DATA_PROVIDER_DATA_UPDATED*);
unsigned short, T_PNAK_DATA_CONSUMER_DATA_CHANGED*);
extern T_PNAK_RESULT pnak_get_provider_data_updated(
unsigned short, T_PNAK_DATA_PROVIDER_DATA_UPDATED*);
/*============================================================================= /*=============================================================================
CALLBACK INTERFACE CALLBACK INTERFACE
=============================================================================*/ =============================================================================*/
typedef int (*T_PNAK_WAIT_OBJECT_CALLBACK)(unsigned short, T_PNAK_WAIT_OBJECT); typedef int (*T_PNAK_WAIT_OBJECT_CALLBACK) (unsigned short, T_PNAK_WAIT_OBJECT);
typedef int (*T_PNAK_HW_START_CALLBACK)(unsigned short, T_PNAK_MODE_ID, void*); typedef int (*T_PNAK_HW_START_CALLBACK) (unsigned short, T_PNAK_MODE_ID, void*);
typedef void (*T_PROVIDER_CALLBACK)(unsigned short, unsigned short, typedef void (*T_PROVIDER_CALLBACK) (unsigned short, unsigned short, unsigned char*, unsigned short, unsigned char*);
unsigned char*, unsigned short, unsigned char*); typedef void (*T_CONSUMER_CALLBACK) (unsigned short, unsigned short, const unsigned char*, unsigned short, unsigned char, unsigned char);
typedef void (*T_CONSUMER_CALLBACK)(unsigned short, unsigned short,
const unsigned char*, unsigned short, unsigned char, unsigned char);
extern T_PNAK_RESULT pnak_register_provider_callback( extern T_PNAK_RESULT pnak_register_provider_callback (unsigned short, T_PROVIDER_CALLBACK);
unsigned short, T_PROVIDER_CALLBACK); extern T_PNAK_RESULT pnak_unregister_provider_callback (unsigned short);
extern T_PNAK_RESULT pnak_unregister_provider_callback(unsigned short);
extern T_PNAK_RESULT pnak_register_consumer_callback( extern T_PNAK_RESULT pnak_register_consumer_callback (unsigned short, T_CONSUMER_CALLBACK);
unsigned short, T_CONSUMER_CALLBACK); extern T_PNAK_RESULT pnak_unregister_consumer_callback (unsigned short);
extern T_PNAK_RESULT pnak_unregister_consumer_callback(unsigned short);
extern T_PNAK_RESULT pnak_register_ethernet_provider_hook( extern T_PNAK_RESULT pnak_register_ethernet_provider_hook (unsigned short, T_PROVIDER_CALLBACK);
unsigned short, T_PROVIDER_CALLBACK); extern T_PNAK_RESULT pnak_unregister_ethernet_provider_hook (unsigned short);
extern T_PNAK_RESULT pnak_unregister_ethernet_provider_hook(unsigned short);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
typedef void (*T_PNAK_CMCTL_STATISTIC_CALLBACK)( typedef void (*T_PNAK_CMCTL_STATISTIC_CALLBACK) (unsigned short, T_PNAK_CMCTL_STATISTIC*);
unsigned short, T_PNAK_CMCTL_STATISTIC*);
extern T_PNAK_RESULT pnak_register_cmctl_statistic_callback( extern T_PNAK_RESULT pnak_register_cmctl_statistic_callback (unsigned short, T_PNAK_CMCTL_STATISTIC_CALLBACK);
unsigned short, T_PNAK_CMCTL_STATISTIC_CALLBACK); extern T_PNAK_RESULT pnak_unregister_cmctl_statistic_callback (unsigned short);
extern T_PNAK_RESULT pnak_unregister_cmctl_statistic_callback(unsigned short);
typedef void (*T_PNAK_CMDEV_STATISTIC_CALLBACK) (unsigned short, T_PNAK_CMDEV_STATISTIC*);
extern T_PNAK_RESULT pnak_register_cmdev_statistic_callback (unsigned short, T_PNAK_CMDEV_STATISTIC_CALLBACK);
extern T_PNAK_RESULT pnak_unregister_cmdev_statistic_callback (unsigned short);
#endif /* __DOXYGEN__ */ #endif /* __DOXYGEN__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* the scai/sdai socket functions are derived from the basic implementation of /* the scai/sdai socket functions are derived from the basic implementation of
...@@ -684,7 +754,7 @@ extern T_PNAK_RESULT pnak_unregister_cmctl_statistic_callback(unsigned short); ...@@ -684,7 +754,7 @@ extern T_PNAK_RESULT pnak_unregister_cmctl_statistic_callback(unsigned short);
* so we have to disable the original definitions * so we have to disable the original definitions
*/ */
#if !defined(SCAI_INCLUDE_SOCKET) && !defined(SDAI_INCLUDE_SOCKET) #if !defined (SCAI_INCLUDE_SOCKET) && !defined(SDAI_INCLUDE_SOCKET)
/****************************************************************************** /******************************************************************************
SOCKET USER INTERFACE SOCKET USER INTERFACE
...@@ -694,10 +764,8 @@ SOCKET USER INTERFACE ...@@ -694,10 +764,8 @@ SOCKET USER INTERFACE
* @socketmainpage * @socketmainpage
* *
* @section Introduction * @section Introduction
* In addition to the realtime ethernet communication via the PROFINET * In addition to the realtime ethernet communication via the PROFINET Application Interface (PNAK)
* Application Interface (PNAK) * Softing offers a universal Socket Interface for implementation of any TCP or UDP based protocol. It
* Softing offers a universal Socket Interface for implementation of any TCP or
* UDP based protocol. It
* enables the integration of various industrial IT functions into the device: * enables the integration of various industrial IT functions into the device:
* *
* - Embedded Webserver for freely designed websites * - Embedded Webserver for freely designed websites
...@@ -706,37 +774,24 @@ SOCKET USER INTERFACE ...@@ -706,37 +774,24 @@ SOCKET USER INTERFACE
* - Telnet for virtual terminal connections * - Telnet for virtual terminal connections
* - Implementation of manufacturer specific application protocols * - Implementation of manufacturer specific application protocols
* *
* The Socket Interface offers a comfortable application interface which * The Socket Interface offers a comfortable application interface which disburdens the user from a lot of
* disburdens the user from a lot of * tasks and provides a lot of automatisms. The special characteristics of each TCP/IP stack will be hidden
* tasks and provides a lot of automatisms. The special characteristics of each * from the user. Establishment and management of TCP connections are handled completely by the socket interface.
* TCP/IP stack will be hidden * The user can focus on the implementation of the desired IT functionality. This allows an easy implementation
* from the user. Establishment and management of TCP connections are handled * of the socket application. The resources needed by the socket interface (see also \ref SocketResources) can be
* completely by the socket interface. * easily adpated to the available memory provided by the used the hardware platform.
* The user can focus on the implementation of the desired IT functionality.
* This allows an easy implementation
* of the socket application. The resources needed by the socket interface (see
* also \ref SocketResources) can be
* easily adpated to the available memory provided by the used the hardware
* platform.
* *
* The communication via the Socket Interface can be used in parallel and * The communication via the Socket Interface can be used in parallel and without influencing the realtime
* without influencing the realtime * communication via the used realtime ethernet protocol. Therefore the realtime ethernet communication
* communication via the used realtime ethernet protocol. Therefore the realtime * will be processed with a higher priority than the communication via the Socket Interface. The network interface
* ethernet communication * is shared between the Socket Interface and the realtime ethernet protocol. Thus a high communication load
* will be processed with a higher priority than the communication via the * to be processed by the realtime ethernet protocol limits the available bandwith and the performance of the
* Socket Interface. The network interface
* is shared between the Socket Interface and the realtime ethernet protocol.
* Thus a high communication load
* to be processed by the realtime ethernet protocol limits the available
* bandwith and the performance of the
* Socket Interface communication. * Socket Interface communication.
* *
* @section Application Interface Description * @section Application Interface Description
* The following figure shows the structure of Softings Socket Interface * The following figure shows the structure of Softings Socket Interface implementation.
* implementation.
* @image html Socket_Structure.png * @image html Socket_Structure.png
* A detailed description of the Socket Application Interface can be found in * A detailed description of the Socket Application Interface can be found in the following chapters:
* the following chapters:
* - \ref sock_defines * - \ref sock_defines
* - \ref sock_structures * - \ref sock_structures
* - \ref sock_functions * - \ref sock_functions
...@@ -761,103 +816,64 @@ SOCKET USER INTERFACE ...@@ -761,103 +816,64 @@ SOCKET USER INTERFACE
* @{ * @{
*/ */
#define MAX_NUMBER_SUPPORTED_SOCKETS (PN_U16)64u #define MAX_NUMBER_SUPPORTED_SOCKETS (PN_U16) 64u
/*--- Socket options --------------------------------------------------------*/ /*--- Socket options --------------------------------------------------------*/
/** Definitions for Socket Flags /** \anchor SocketFlags @name Socket Flags
* Definitions for Socket Flags
* @{ * @{
*/ */
#define SOCK_FLAG_TYPE_UDP 0x00000000uL /**< Socket type TCP */ #define SOCK_FLAG_TYPE_UDP 0x00000000uL /**< Socket type TCP */
#define SOCK_FLAG_TYPE_TCP 0x00008000uL /**< Socket type UDP */ #define SOCK_FLAG_TYPE_TCP 0x00008000uL /**< Socket type UDP */
#define SOCK_FLAG_ENABLE_KEEPALIVE \ #define SOCK_FLAG_ENABLE_KEEPALIVE (SOCK_FLAG_TYPE_TCP | 0x00000001uL) /**< Enables keep-alive packets to supervise a TCP connection */
(SOCK_FLAG_TYPE_TCP | 0x00000001uL) /**< Enables keep-alive packets to \ #define SOCK_FLAG_ENABLE_BROADCAST (SOCK_FLAG_TYPE_UDP | 0x00000002uL) /**< Enables the transmission of broadcast messages over a UDP socket */
supervise a TCP connection */ #define SOCK_FLAG_ENABLE_MULTICAST (SOCK_FLAG_TYPE_UDP | 0x00000004uL) /**< Enables the transmission of multicast messages over a UDP socket */
#define SOCK_FLAG_ENABLE_BROADCAST \ #define SOCK_FLAG_USER_MASK 0x0000FFFFuL /**< Specifies the bits wich are valid for the socket application */
(SOCK_FLAG_TYPE_UDP | 0x00000002uL) /**< Enables the transmission of \
broadcast messages over a UDP \
socket */
#define SOCK_FLAG_ENABLE_MULTICAST \
(SOCK_FLAG_TYPE_UDP | 0x00000004uL) /**< Enables the transmission of \
multicast messages over a UDP \
socket */
#define SOCK_FLAG_USER_MASK \
0x0000FFFFuL /**< Specifies the bits wich are valid for the socket \
application */
/** @} */ /** @} */
/*--- Socket error codes ----------------------------------------------------*/ /*--- Socket error codes ----------------------------------------------------*/
/** Definitions for Socket Interface Error Codes /** \anchor ErrorCode @name Socket Interface Error Codes
* Definitions for Socket Interface Error Codes
* @{ * @{
*/ */
typedef enum _T_SOCKET_RESULT { typedef enum _T_SOCKET_RESULT
SOCK_SUCCESS = 0u, /**< General success return value */ {
SOCK_ERR_INVALID_ARGUMENT, /**< Passed argument is invalid */ SOCK_SUCCESS = 0u, /**< General success return value */
SOCK_ERR_API_ALREADY_INITIALIZED, /**< Socket Interface already initialized */ SOCK_ERR_INVALID_ARGUMENT, /**< Passed argument is invalid */
SOCK_ERR_API_NOT_INITIALIZED, /**< Socket Interface not initialized */ SOCK_ERR_API_ALREADY_INITIALIZED, /**< Socket Interface already initialized */
SOCK_ERR_INVALID_SOCKET_ID, /**< The passed socket ID is invalid */ SOCK_ERR_API_NOT_INITIALIZED, /**< Socket Interface not initialized */
SOCK_ERR_OUT_OF_SOCKETS, /**< No free socket available */ SOCK_ERR_INVALID_SOCKET_ID, /**< The passed socket ID is invalid */
SOCK_ERR_SOCKET_NOT_CREATED, /**< The specified socket has not been created. SOCK_ERR_OUT_OF_SOCKETS, /**< No free socket available */
*/ SOCK_ERR_SOCKET_NOT_CREATED, /**< The specified socket has not been created. */
SOCK_ERR_SOCKET_OFFLINE, /**< The local port associated with the socket is not SOCK_ERR_SOCKET_OFFLINE, /**< The local port associated with the socket is not open. Sending/Receiving of messages is not possible. */
open. Sending/Receiving of messages is not SOCK_ERR_SOCKET_BUSY, /**< A send request is rejected because a previous send request on the specified socket is not completed */
possible. */ SOCK_ERR_SOCKET_NOT_CONNECTED, /**< The request is rejected because the specified TCP connection or no TCP connection has been established for the specified socket. */
SOCK_ERR_SOCKET_BUSY, /**< A send request is rejected because a previous send SOCK_ERR_SOCKET_CONNECTED, /**< The request is rejected because the specified TCP connection has established a connection before the filter was activated. */
request on the specified socket is not completed */ SOCK_ERR_ADDR_IN_USE, /**< The passed local address is already in use by another socket. */
SOCK_ERR_SOCKET_NOT_CONNECTED, /**< The request is rejected because the SOCK_ERR_INVALID_LOCAL_ADDR, /**< The passed local IP address is invalid. It is not possible to bind the socket to this address. Which IP addresses are allowed depends
specified TCP connection or no TCP on the socket configuration (e.g. socket type UDP or TCP) and the network settings adjusted by calling the function sock_init(). */
connection has been established for the SOCK_ERR_INVALID_REMOTE_ADDR, /**< The passed remote IP address is invalid. It is not possible to send or connect to this address. Which IP addresses are allowed depends
specified socket. */ on the socket configuration (e.g. socket type UDP or TCP) and the network settings adjusted by calling the function sock_init(). */
SOCK_ERR_SOCKET_CONNECTED, /**< The request is rejected because the specified SOCK_ERR_NO_DATA_RECEIVED, /**< No data has been received on the specfied socket or TCP connection. */
TCP connection has established a connection SOCK_ERR_NOT_SUPPORTED, /**< The requested action is not supported on the specified socket. */
before the filter was activated. */ SOCK_ERR_TEMPORARY_NOT_EXECUTABLE, /**< The requested action is temporary not executable on the specified socket due a concurrent pending request. */
SOCK_ERR_ADDR_IN_USE, /**< The passed local address is already in use by SOCK_ERR_FATAL_ERROR, /**< A fatal error is reported during execution of function. */
another socket. */ SOCK_ERR_LIBRARY_NOT_LOADED /**< Can not load socket library */
SOCK_ERR_INVALID_LOCAL_ADDR, /**< The passed local IP address is invalid. It
is not possible to bind the socket to this
address. Which IP addresses are allowed
depends
on the socket configuration (e.g. socket
type UDP or TCP) and the network settings
adjusted by calling the function sock_init().
*/
SOCK_ERR_INVALID_REMOTE_ADDR, /**< The passed remote IP address is invalid. It
is not possible to send or connect to this
address. Which IP addresses are allowed
depends
on the socket configuration (e.g. socket
type UDP or TCP) and the network settings
adjusted by calling the function sock_init().
*/
SOCK_ERR_NO_DATA_RECEIVED, /**< No data has been received on the specfied
socket or TCP connection. */
SOCK_ERR_NOT_SUPPORTED, /**< The requested action is not supported on the
specified socket. */
SOCK_ERR_TEMPORARY_NOT_EXECUTABLE, /**< The requested action is temporary not
executable on the specified socket due a
concurrent pending request. */
SOCK_ERR_FATAL_ERROR, /**< A fatal error is reported during execution of
function. */
SOCK_ERR_LIBRARY_NOT_LOADED /**< Can not load socket library */
} T_SOCKET_RESULT; } T_SOCKET_RESULT;
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define SOCK_IP_ADDR_ANY \ #define SOCK_IP_ADDR_ANY 0x00000000uL /**< Can be used as local IP address when creating a socket to bind the socket to all the IP addresses (If the system has
0x00000000uL /**< Can be used as local IP address when creating a socket to \ multiple IP addresses) or if the local IP address is unknown. */
bind the socket to all the IP addresses (If the system has \ #define SOCK_PORT_ANY 0u /**< Can be used as local port when creating a TCP Client socket to let the TCP/IP stack select a unique local port from the
multiple IP addresses) or if the local IP address is \ dynamic client port range. */
unknown. */
#define SOCK_PORT_ANY \
0u /**< Can be used as local port when creating a TCP Client socket to let \
the TCP/IP stack select a unique local port from the \
dynamic client port range. */
/** @} */ /** @} */
/*===========================================================================*/ /*===========================================================================*/
...@@ -865,18 +881,18 @@ typedef enum _T_SOCKET_RESULT { ...@@ -865,18 +881,18 @@ typedef enum _T_SOCKET_RESULT {
/** \addtogroup sock_structures Data Structures /** \addtogroup sock_structures Data Structures
* @{ * @{
* \brief Specifies a transport IP address and port. * \brief Specifies a transport IP address and port.
* All of the structure data must be specified in network-byte-order * All of the structure data must be specified in network-byte-order (big-endian).
* (big-endian).
*/ */
typedef struct _T_PNAK_SOCK_ADDR { typedef struct _T_PNAK_SOCK_ADDR
PN_U32 IpAddress; /**< IP address */ {
PN_U32 IpAddress; /**< IP address */
unsigned short Port; /**< port number */ unsigned short Port; /**< port number */
unsigned char Alignment[2]; unsigned char Alignment [2];
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_ADDR); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_ADDR);
/** @} */ /** @} */
...@@ -886,22 +902,14 @@ typedef struct _T_PNAK_SOCK_ADDR { ...@@ -886,22 +902,14 @@ typedef struct _T_PNAK_SOCK_ADDR {
* @{ * @{
* \brief Configurable Options for the socket interface * \brief Configurable Options for the socket interface
*/ */
typedef struct _T_PNAK_SOCK_CONFIG_OPTIONS { typedef struct _T_PNAK_SOCK_CONFIG_OPTIONS
PN_U32 {
Timeout; /**< Keep-Alive Timeout in milliseconds. The Keep-Alive Timeout PN_U32 Timeout; /**< Keep-Alive Timeout in milliseconds. The Keep-Alive Timeout will be used for the supervision of TCP connections. The connection will be aborted if the
will be used for the supervision of TCP connections. The remote connection partner did not show activity within this timeout. The supervision of TCP connections can be enabled/disabled socket-specific when
connection will be aborted if the creating the socket by calling sock_create(). For UDP sockets the application needs to perform a supervision if necessary. If the timeout value is set to 0
remote connection partner did not show activity within this and #SOCK_FLAG_ENABLE_KEEPALIVE is set when creating a socket, a default value for the Keep-Alive Timeout will be used. */
timeout. The supervision of TCP connections can be
enabled/disabled socket-specific when } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_CONFIG_OPTIONS);
creating the socket by calling sock_create(). For UDP
sockets the application needs to perform a supervision if
necessary. If the timeout value is set to 0
and #SOCK_FLAG_ENABLE_KEEPALIVE is set when creating a
socket, a default value for the Keep-Alive Timeout will be
used. */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_CONFIG_OPTIONS);
/** @} */ /** @} */
...@@ -910,19 +918,18 @@ typedef struct _T_PNAK_SOCK_CONFIG_OPTIONS { ...@@ -910,19 +918,18 @@ typedef struct _T_PNAK_SOCK_CONFIG_OPTIONS {
/** \addtogroup sock_structures Data Structures /** \addtogroup sock_structures Data Structures
* @{ * @{
* \brief Network specific parameter * \brief Network specific parameter
* All of the structure data must be specified in network-byte-order * All of the structure data must be specified in network-byte-order (big-endian).
* (big-endian).
*/ */
typedef struct _T_PNAK_SOCK_NETWORK_SETTINGS { typedef struct _T_PNAK_SOCK_NETWORK_SETTINGS
PN_U32 IpAddress; /**< The IP-Address of the Device. For future use only. */ {
PN_U32 SubnetMask; /**< The Netmask of the Device. For future use only. */ PN_U32 IpAddress; /**< The IP-Address of the Device. For future use only. */
PN_U32 GatewayAddress; /**< The Gateway of the Device. For future use only. */ PN_U32 SubnetMask; /**< The Netmask of the Device. For future use only. */
PN_U32 GatewayAddress; /**< The Gateway of the Device. For future use only. */
unsigned char unsigned char MacAddress [6]; /**< The MAC address of the device. For future use only. */
MacAddress[6]; /**< The MAC address of the device. For future use only. */ unsigned char Alignment [2];
unsigned char Alignment[2];
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_NETWORK_SETTINGS); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_NETWORK_SETTINGS);
/** @} */ /** @} */
...@@ -932,13 +939,12 @@ typedef struct _T_PNAK_SOCK_NETWORK_SETTINGS { ...@@ -932,13 +939,12 @@ typedef struct _T_PNAK_SOCK_NETWORK_SETTINGS {
* @{ * @{
* \brief This structure holds the initialization data for the socket interface * \brief This structure holds the initialization data for the socket interface
*/ */
typedef struct _T_PNAK_SOCK_INIT { typedef struct _T_PNAK_SOCK_INIT
T_PNAK_SOCK_NETWORK_SETTINGS {
NetworkSettings; /**< Network specific parameter */ T_PNAK_SOCK_NETWORK_SETTINGS NetworkSettings; /**< Network specific parameter */
T_PNAK_SOCK_CONFIG_OPTIONS T_PNAK_SOCK_CONFIG_OPTIONS ConfigOptions; /**< Configurable Options for the socket interface */
ConfigOptions; /**< Configurable Options for the socket interface */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_INIT); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_INIT);
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -949,44 +955,25 @@ typedef struct _T_PNAK_SOCK_INIT { ...@@ -949,44 +955,25 @@ typedef struct _T_PNAK_SOCK_INIT {
* Status of a TCP connection * Status of a TCP connection
* @{ * @{
*/ */
#define SOCK_TCP_CONNECTION_STATUS_UNCONNECTED \ #define SOCK_TCP_CONNECTION_STATUS_UNCONNECTED 0x00000001uL /**< TCP connection not established */
0x00000001uL /**< TCP connection not established */ #define SOCK_TCP_CONNECTION_STATUS_CONNECTING 0x00000002uL /**< A TCP connection establishment is in progress. This status is only possible for a TCP client socket. */
#define SOCK_TCP_CONNECTION_STATUS_CONNECTING \ #define SOCK_TCP_CONNECTION_STATUS_CONNECTED 0x00000003uL /**< TCP connection established */
0x00000002uL /**< A TCP connection establishment is in progress. This status \
is only possible for a TCP client socket. */
#define SOCK_TCP_CONNECTION_STATUS_CONNECTED \
0x00000003uL /**< TCP connection established */
/** @} */ /** @} */
/** \anchor ConnectionStatusCode @name TCP Connection Status Codes /** \anchor ConnectionStatusCode @name TCP Connection Status Codes
* Error Codes of a TCP connection * Error Codes of a TCP connection
* @{ * @{
*/ */
#define SOCK_TCP_CONNECTION_STATUS_CODE_NO_ERROR \ #define SOCK_TCP_CONNECTION_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */
0x00000000uL /**< No error detected */ #define SOCK_TCP_CONNECTION_STATUS_CODE_INTERNAL_ERROR 0x00000001uL /**< An internal error occurred in the socket interface causing the connection to abort. */
#define SOCK_TCP_CONNECTION_STATUS_CODE_INTERNAL_ERROR \ #define SOCK_TCP_CONNECTION_STATUS_CODE_CLOSED_REMOTELY 0x00000002uL /**< The connection has been orderly closed by the remote connection partner (TCP FIN received). */
0x00000001uL /**< An internal error occurred in the socket interface causing \ #define SOCK_TCP_CONNECTION_STATUS_CODE_ABORTED_REMOTELY 0x00000003uL /**< The connection has been aborted by the remote connection partner (TCP RST received), e.g. because
the connection to abort. */ the remote partner has detected an error or temporarily crashed. */
#define SOCK_TCP_CONNECTION_STATUS_CODE_CLOSED_REMOTELY \ #define SOCK_TCP_CONNECTION_STATUS_CODE_TIMEOUT 0x00000004uL /**< The connection has been aborted because of a network failure or because the remote connection partner failed
0x00000002uL /**< The connection has been orderly closed by the remote \ to respond within the configured supervision timeout (see also T_PNAK_SOCK_CONFIG_OPTIONS). */
connection partner (TCP FIN received). */ #define SOCK_TCP_CONNECTION_STATUS_CODE_CONNECT_REJECTED 0x00000005uL /**< It was not possible to establish a connection because the destination host rejected the connect request,
#define SOCK_TCP_CONNECTION_STATUS_CODE_ABORTED_REMOTELY \ e.g. because the remote port is closed. This error only occurs for a TCP client socket. To retry connection
0x00000003uL /**< The connection has been aborted by the remote connection \ establishment the application has to close the socket and re-create the socket again. */
partner (TCP RST received), e.g. because \
the remote partner has detected an error or temporarily \
crashed. */
#define SOCK_TCP_CONNECTION_STATUS_CODE_TIMEOUT \
0x00000004uL /**< The connection has been aborted because of a network \
failure or because the remote connection partner failed \
to respond within the configured supervision timeout (see \
also T_PNAK_SOCK_CONFIG_OPTIONS). */
#define SOCK_TCP_CONNECTION_STATUS_CODE_CONNECT_REJECTED \
0x00000005uL /**< It was not possible to establish a connection because the \
destination host rejected the connect request, \
e.g. because the remote port is closed. This error only \
occurs for a TCP client socket. To retry connection \
establishment the application has to close the socket and \
re-create the socket again. */
/** @} */ /** @} */
/** @} */ /** @} */
...@@ -994,32 +981,28 @@ typedef struct _T_PNAK_SOCK_INIT { ...@@ -994,32 +981,28 @@ typedef struct _T_PNAK_SOCK_INIT {
* @{ * @{
* \brief This structure holds status informations about a single TCP connection * \brief This structure holds status informations about a single TCP connection
*/ */
typedef struct _T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS { typedef struct _T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS
PN_U32 Status; /**< Local status of the TCP connection. Valid values: \ref {
ConnectionStatus */ PN_U32 Status; /**< Local status of the TCP connection. Valid values: \ref ConnectionStatus */
PN_U32 PN_U32 StatusCode; /**< Indicates the last error of the TCP connection. Valid values: \ref ConnectionStatusCode */
StatusCode; /**< Indicates the last error of the TCP connection. Valid
values: \ref ConnectionStatusCode */
T_PNAK_SOCK_ADDR T_PNAK_SOCK_ADDR RemoteAddr; /**< Address information of the remote connection partner */
RemoteAddr; /**< Address information of the remote connection partner */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS);
/** @} */ /** @} */
/** \addtogroup sock_structures Data Structures /** \addtogroup sock_structures Data Structures
* @{ * @{
* \brief This structure holds status informations about all TCP connections of * \brief This structure holds status informations about all TCP connections of a socket
* a socket
*/ */
typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA { typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA
PN_U32 NumberConnections; /**< Number of TCP connection for which status info {
is provided */ PN_U32 NumberConnections; /**< Number of TCP connection for which status info is provided */
/*T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS Connection [NumberConnections];*/ /**< TCP connection status information */ /*T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS Connection [NumberConnections];*/ /**< TCP connection status information */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA);
/** @} */ /** @} */
...@@ -1029,28 +1012,18 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA { ...@@ -1029,28 +1012,18 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA {
* Status of a socket * Status of a socket
* @{ * @{
*/ */
#define SOCK_LOCAL_STATUS_CLOSED \ #define SOCK_LOCAL_STATUS_CLOSED 0x00000001uL /**< The local socket is closed */
0x00000001uL /**< The local socket is closed \ #define SOCK_LOCAL_STATUS_OFFLINE 0x00000002uL /**< The local port associated with the socket is not open. Sending/Receiving of messages is not possible. */
*/ #define SOCK_LOCAL_STATUS_ONLINE 0x00000003uL /**< The local port associated with the socket is open. Sending/Receiving of messages is possible. */
#define SOCK_LOCAL_STATUS_OFFLINE \
0x00000002uL /**< The local port associated with the socket is not open. \
Sending/Receiving of messages is not possible. */
#define SOCK_LOCAL_STATUS_ONLINE \
0x00000003uL /**< The local port associated with the socket is open. \
Sending/Receiving of messages is possible. */
/** @} */ /** @} */
/** \anchor SocketStatusCode @name Socket Status Codes /** \anchor SocketStatusCode @name Socket Status Codes
* Error Codes of a socket * Error Codes of a socket
* @{ * @{
*/ */
#define SOCK_LOCAL_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */ #define SOCK_LOCAL_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */
#define SOCK_LOCAL_STATUS_CODE_ADDR_IN_USE \ #define SOCK_LOCAL_STATUS_CODE_ADDR_IN_USE 0x00000001uL /**< The local address passed with sock_create() is already in use by another socket. */
0x00000001uL /**< The local address passed with sock_create() is already in \ #define SOCK_LOCAL_STATUS_CODE_INTERNAL_ERROR 0x00000002uL /**< An internal error occurred in the socket interface causing the socket to close. */
use by another socket. */
#define SOCK_LOCAL_STATUS_CODE_INTERNAL_ERROR \
0x00000002uL /**< An internal error occurred in the socket interface causing \
the socket to close. */
/** @} */ /** @} */
/** @} */ /** @} */
...@@ -1058,20 +1031,19 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA { ...@@ -1058,20 +1031,19 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA {
* @{ * @{
* \brief This structure holds status informations about a socket * \brief This structure holds status informations about a socket
*/ */
typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS { typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS
PN_U32 Status; /**< Common socket status information. Valid values: \ref {
SocketStatus */ PN_U32 Status; /**< Common socket status information. Valid values: \ref SocketStatus */
PN_U32 StatusCode; /**< Common socket error code. Valid values: \ref PN_U32 StatusCode; /**< Common socket error code. Valid values: \ref SocketStatusCode */
SocketStatusCode */
union
union { {
T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA Tcp; /**< TCP specific socket status information */
Tcp; /**< TCP specific socket status information */
/* UDP specific socket status information not existing */ /* UDP specific socket status information not existing */
} UseAs; } UseAs;
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_GET_LOCAL_STATUS); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_GET_LOCAL_STATUS);
/** @} */ /** @} */
...@@ -1083,30 +1055,20 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS { ...@@ -1083,30 +1055,20 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS {
* Send Status of a socket * Send Status of a socket
* @{ * @{
*/ */
#define SOCK_SEND_STATUS_NOT_BUSY \ #define SOCK_SEND_STATUS_NOT_BUSY 0x00000001uL /**< No send request produced by the application */
0x00000001uL /**< No send request produced by the application */ #define SOCK_SEND_STATUS_BUSY 0x00000002uL /**< The send request is in progress. */
#define SOCK_SEND_STATUS_BUSY \
0x00000002uL /**< The send request is in progress. */
/** @} */ /** @} */
/** \anchor SendStatusCode @name Send Status Codes /** \anchor SendStatusCode @name Send Status Codes
* Send Error Codes * Send Error Codes
* @{ * @{
*/ */
#define SOCK_SEND_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */ #define SOCK_SEND_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */
#define SOCK_SEND_STATUS_CODE_NO_BUFFERS \ #define SOCK_SEND_STATUS_CODE_NO_BUFFERS 0x00000001uL /**< The TCP/IP stack was unable to allocate an internal buffer or the output queue is full. */
0x00000001uL /**< The TCP/IP stack was unable to allocate an internal buffer \ #define SOCK_SEND_STATUS_CODE_HOST_UNREACHABLE 0x00000002uL /**< The destination host is unreachable, e.g. the destination host is down */
or the output queue is full. */ #define SOCK_SEND_STATUS_CODE_REJECTED 0x00000003uL /**< The destination host rejected the message, e.g. remote port is closed.
#define SOCK_SEND_STATUS_CODE_HOST_UNREACHABLE \ This error can only be returned by TCP sockets. */
0x00000002uL /**< The destination host is unreachable, e.g. the destination \ #define SOCK_SEND_STATUS_CODE_SEND_ERROR 0x00000004uL /**< The TCP/IP stack reported a general problem sending the message. */
host is down */
#define SOCK_SEND_STATUS_CODE_REJECTED \
0x00000003uL /**< The destination host rejected the message, e.g. remote \
port is closed. \
This error can only be returned by TCP sockets. */
#define SOCK_SEND_STATUS_CODE_SEND_ERROR \
0x00000004uL /**< The TCP/IP stack reported a general problem sending the \
message. */
/** @} */ /** @} */
/** @} */ /** @} */
...@@ -1114,11 +1076,11 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS { ...@@ -1114,11 +1076,11 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS {
* @{ * @{
* \brief This structure holds TCP specific send status informations * \brief This structure holds TCP specific send status informations
*/ */
typedef struct _T_PNAK_SOCK_TCP_SEND_STATUS_DATA { typedef struct _T_PNAK_SOCK_TCP_SEND_STATUS_DATA
T_PNAK_SOCK_ADDR {
RemoteAddr; /**< Address information of the remote connection partner */ T_PNAK_SOCK_ADDR RemoteAddr; /**< Address information of the remote connection partner */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_TCP_SEND_STATUS_DATA); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_TCP_SEND_STATUS_DATA);
/** @} */ /** @} */
...@@ -1126,20 +1088,19 @@ typedef struct _T_PNAK_SOCK_TCP_SEND_STATUS_DATA { ...@@ -1126,20 +1088,19 @@ typedef struct _T_PNAK_SOCK_TCP_SEND_STATUS_DATA {
* @{ * @{
* \brief This structure holds send status informations * \brief This structure holds send status informations
*/ */
typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS { typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS
PN_U32 Status; /**< Common send status information. Valid values: \ref {
SendStatus */ PN_U32 Status; /**< Common send status information. Valid values: \ref SendStatus */
PN_U32 StatusCode; /**< Common send error code. Valid values: \ref PN_U32 StatusCode; /**< Common send error code. Valid values: \ref SendStatusCode */
SendStatusCode */
union
union { {
T_PNAK_SOCK_TCP_SEND_STATUS_DATA T_PNAK_SOCK_TCP_SEND_STATUS_DATA Tcp; /**< TCP specific send status information */
Tcp; /**< TCP specific send status information */
/* UDP specific send status information not existing */ /* UDP specific send status information not existing */
} UseAs; } UseAs;
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_GET_SEND_STATUS); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_GET_SEND_STATUS);
/** @} */ /** @} */
...@@ -1151,21 +1112,15 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS { ...@@ -1151,21 +1112,15 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS {
* Receive Status of a socket * Receive Status of a socket
* @{ * @{
*/ */
#define SOCK_RECEIVE_STATUS_NO_DATA_RECEIVED \ #define SOCK_RECEIVE_STATUS_NO_DATA_RECEIVED 0x00000000uL /**< No data on the specfied socket or TCP connection has been received. */
0x00000000uL /**< No data on the specfied socket or TCP connection has been \ #define SOCK_RECEIVE_STATUS_DATA_RECEIVED 0x00000001uL /**< New data has been received on the specfied socket or TCP connection. */
received. */
#define SOCK_RECEIVE_STATUS_DATA_RECEIVED \
0x00000001uL /**< New data has been received on the specfied socket or TCP \
connection. */
/** @} */ /** @} */
/** \anchor ReceiveStatusCode @name Receive Status Codes /** \anchor ReceiveStatusCode @name Receive Status Codes
* Receive Error Codes * Receive Error Codes
* @{ * @{
*/ */
#define SOCK_RECEIVE_STATUS_CODE_NO_ERROR \ #define SOCK_RECEIVE_STATUS_CODE_NO_ERROR 0x00000000uL /**< No error detected */
0x00000000uL /**< No error detected \
*/
/** @} */ /** @} */
/** @} */ /** @} */
...@@ -1173,11 +1128,11 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS { ...@@ -1173,11 +1128,11 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS {
* @{ * @{
* \brief This structure holds TCP specific receive status informations * \brief This structure holds TCP specific receive status informations
*/ */
typedef struct _T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA { typedef struct _T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA
T_PNAK_SOCK_ADDR {
RemoteAddr; /**< Address information of the remote connection partner */ T_PNAK_SOCK_ADDR RemoteAddr; /**< Address information of the remote connection partner */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA);
/** @} */ /** @} */
...@@ -1185,20 +1140,19 @@ typedef struct _T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA { ...@@ -1185,20 +1140,19 @@ typedef struct _T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA {
* @{ * @{
* \brief This structure holds receive status informations * \brief This structure holds receive status informations
*/ */
typedef struct _T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS { typedef struct _T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS
PN_U32 Status; /**< Common receive status information. Valid values: \ref {
ReceiveStatus */ PN_U32 Status; /**< Common receive status information. Valid values: \ref ReceiveStatus */
PN_U32 StatusCode; /**< Common receive error code. Valid values: \ref PN_U32 StatusCode; /**< Common receive error code. Valid values: \ref ReceiveStatusCode */
ReceiveStatusCode */
union
union { {
T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA Tcp; /**< TCP specific receive status information */
Tcp; /**< TCP specific receive status information */
/* UDP specific send status information not existing */ /* UDP specific send status information not existing */
} UseAs; } UseAs;
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS);
/** @} */ /** @} */
...@@ -1208,30 +1162,30 @@ typedef struct _T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS { ...@@ -1208,30 +1162,30 @@ typedef struct _T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS {
* @{ * @{
* \brief This structure specifies the TCP connection which shall be aborted * \brief This structure specifies the TCP connection which shall be aborted
*/ */
typedef struct _T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION { typedef struct _T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION
T_PNAK_SOCK_ADDR {
RemoteAddr; /**< Address information of the remote connection partner */ T_PNAK_SOCK_ADDR RemoteAddr; /**< Address information of the remote connection partner */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION);
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define SOCK_MAX_NUMBER_FILTER_ENTRIES 4u #define SOCK_MAX_NUMBER_FILTER_ENTRIES 4u
/** \addtogroup sock_structures Data Structures /** \addtogroup sock_structures Data Structures
* @{ * @{
* \brief This structure specifies the IP addresses from which a connection * \brief This structure specifies the IP addresses from which a connection establishment shall be accepted
* establishment shall be accepted
*/ */
typedef struct _T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER { typedef struct _T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER
PN_U16 NumberEntries; /**< number of filter entries */ {
PN_U16 Alignment; PN_U16 NumberEntries; /**< number of filter entries */
PN_U16 Alignment;
PN_U32 Filter[SOCK_MAX_NUMBER_FILTER_ENTRIES]; /**< IP address */ PN_U32 Filter [SOCK_MAX_NUMBER_FILTER_ENTRIES]; /**< IP address */
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER);
/** @} */ /** @} */
...@@ -1239,13 +1193,13 @@ typedef struct _T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER { ...@@ -1239,13 +1193,13 @@ typedef struct _T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER {
/** \addtogroup sock_structures Data Structures /** \addtogroup sock_structures Data Structures
* @{ * @{
* \brief This structure specifies the IP addresses of the multicast group the * \brief This structure specifies the IP addresses of the multicast group the application wants to join or leave
* application wants to join or leave
*/ */
typedef struct _T_PNAK_SOCK_IOC_MULTICAST { typedef struct _T_PNAK_SOCK_IOC_MULTICAST
PN_U32 IpAddress; {
PN_U32 IpAddress;
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IOC_MULTICAST); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IOC_MULTICAST);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -1255,20 +1209,13 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST { ...@@ -1255,20 +1209,13 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST {
* IO Control Commands for a socket * IO Control Commands for a socket
* @{ * @{
*/ */
#define SOCK_IOC_GET_LOCAL_STATUS \ #define SOCK_IOC_GET_LOCAL_STATUS 0x00000001uL /**< Get the local socket status */
0x00000001uL /**< Get the local socket status */ #define SOCK_IOC_GET_SEND_STATUS 0x00000002uL /**< Get the status of a send request */
#define SOCK_IOC_GET_SEND_STATUS \ #define SOCK_IOC_GET_RECEIVE_STATUS 0x00000003uL /**< Checks if new data has been received */
0x00000002uL /**< Get the status of a send request */ #define SOCK_IOC_CLOSE_TCP_CONNECTION 0x00000004uL /**< Closes a TCP connection */
#define SOCK_IOC_GET_RECEIVE_STATUS \ #define SOCK_IOC_TCP_ACCEPT_FILTER 0x00000005uL /**< Defines which IP Addresses are accepted by the socket */
0x00000003uL /**< Checks if new data has been received */ #define SOCK_IOC_UDP_ADD_MULTICAST 0x00000006uL /**< Join a multicast group */
#define SOCK_IOC_CLOSE_TCP_CONNECTION \ #define SOCK_IOC_UDP_DEL_MULTICAST 0x00000007uL /**< Leave a multicast group */
0x00000004uL /**< Closes a TCP connection */
#define SOCK_IOC_TCP_ACCEPT_FILTER \
0x00000005uL /**< Defines which IP Addresses are accepted by the socket */
#define SOCK_IOC_UDP_ADD_MULTICAST 0x00000006uL /**< Join a multicast group */
#define SOCK_IOC_UDP_DEL_MULTICAST \
0x00000007uL /**< Leave a multicast group \
*/
/** @} */ /** @} */
/** @} */ /** @} */
...@@ -1276,28 +1223,23 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST { ...@@ -1276,28 +1223,23 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST {
* @{ * @{
* \brief This structure holds the data for an IO Control Command * \brief This structure holds the data for an IO Control Command
*/ */
typedef struct _T_PNAK_SOCK_IO_CONTROL { typedef struct _T_PNAK_SOCK_IO_CONTROL
PN_U32 Command; /**< Specifies the IO Control Command. Valid values: \ref {
IoctlCommand */ PN_U32 Command; /**< Specifies the IO Control Command. Valid values: \ref IoctlCommand */
union { union
T_PNAK_SOCK_IOC_GET_LOCAL_STATUS {
GetLocalStatus; /**< Local Socket Status informations */ T_PNAK_SOCK_IOC_GET_LOCAL_STATUS GetLocalStatus; /**< Local Socket Status informations */
T_PNAK_SOCK_IOC_GET_SEND_STATUS T_PNAK_SOCK_IOC_GET_SEND_STATUS GetSendStatus; /**< Send Status informations */
GetSendStatus; /**< Send Status informations */ T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS GetReceiveStatus; /**< Receive Status informations */
T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION CloseTcpConnection; /**< TCP connection which shall be closed */
GetReceiveStatus; /**< Receive Status informations */ T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER TcpAcceptFilter; /**< IP Address which shall be able to connect to the server */
T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION T_PNAK_SOCK_IOC_MULTICAST AddMulticast; /**< Multicast group to join */
CloseTcpConnection; /**< TCP connection which shall be closed */ T_PNAK_SOCK_IOC_MULTICAST DelMulticast; /**< Multicast group to leave */
T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER
TcpAcceptFilter; /**< IP Address which shall be able to connect to the
server */
T_PNAK_SOCK_IOC_MULTICAST AddMulticast; /**< Multicast group to join */
T_PNAK_SOCK_IOC_MULTICAST DelMulticast; /**< Multicast group to leave */
} UseAs; } UseAs;
} PACK_WORD_ALIGNMENT(T_PNAK_SOCK_IO_CONTROL); } PACK_WORD_ALIGNMENT (T_PNAK_SOCK_IO_CONTROL);
/** @} */ /** @} */
...@@ -1306,37 +1248,32 @@ FUNCTION DECLARATION ...@@ -1306,37 +1248,32 @@ FUNCTION DECLARATION
******************************************************************************/ ******************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef __DOXYGEN__ #ifndef __DOXYGEN__
/*--- initialization/termination functions ----------------------------------*/ /*--- initialization/termination functions ----------------------------------*/
extern T_SOCKET_RESULT pnak_sock_init(unsigned short, T_PNAK_SOCK_INIT*); extern T_SOCKET_RESULT pnak_sock_init (unsigned short, T_PNAK_SOCK_INIT*);
extern T_SOCKET_RESULT pnak_sock_term(unsigned short); extern T_SOCKET_RESULT pnak_sock_term (unsigned short);
/*--- socket interface functions --------------------------------------------*/ /*--- socket interface functions --------------------------------------------*/
extern T_SOCKET_RESULT pnak_sock_create(unsigned short, PN_U32, extern T_SOCKET_RESULT pnak_sock_create (unsigned short, PN_U32, T_PNAK_SOCK_ADDR*, T_PNAK_SOCK_ADDR*, unsigned short*);
T_PNAK_SOCK_ADDR*, T_PNAK_SOCK_ADDR*, unsigned short*); extern T_SOCKET_RESULT pnak_sock_close (unsigned short, unsigned short);
extern T_SOCKET_RESULT pnak_sock_close(unsigned short, unsigned short); extern T_SOCKET_RESULT pnak_sock_send (unsigned short, unsigned short, T_PNAK_SOCK_ADDR*, PN_U16, const unsigned char*);
extern T_SOCKET_RESULT pnak_sock_send(unsigned short, unsigned short, extern T_SOCKET_RESULT pnak_sock_receive (unsigned short, unsigned short, T_PNAK_SOCK_ADDR*, PN_U16*, unsigned char*);
T_PNAK_SOCK_ADDR*, PN_U16, const unsigned char*); extern T_SOCKET_RESULT pnak_sock_ioctl (unsigned short, unsigned short, T_PNAK_SOCK_IO_CONTROL*);
extern T_SOCKET_RESULT pnak_sock_receive(
unsigned short, unsigned short, T_PNAK_SOCK_ADDR*, PN_U16*, unsigned char*);
extern T_SOCKET_RESULT pnak_sock_ioctl(
unsigned short, unsigned short, T_PNAK_SOCK_IO_CONTROL*);
/*--- socket interface helper functions -------------------------------------*/ /*--- socket interface helper functions -------------------------------------*/
extern T_SOCKET_RESULT pnak_sock_get_receive_status( extern T_SOCKET_RESULT pnak_sock_get_receive_status (unsigned short, T_BITSET_64*);
unsigned short, T_BITSET_64*);
#endif /* __DOXYGEN__ */ #endif /* __DOXYGEN__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* SCAI_INCLUDE_SOCKET || SDAI_INCLUDE_SOCKET */ #endif /* SCAI_INCLUDE_SOCKET || SDAI_INCLUDE_SOCKET */
...@@ -1344,18 +1281,18 @@ extern T_SOCKET_RESULT pnak_sock_get_receive_status( ...@@ -1344,18 +1281,18 @@ extern T_SOCKET_RESULT pnak_sock_get_receive_status(
/*****************************************************************************/ /*****************************************************************************/
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#pragma warning(disable : 4103) /* used #pragma pack to reset alignment */ #pragma warning (disable : 4103) /* used #pragma pack to reset alignment */
#pragma pack(pop) #pragma pack(pop)
#pragma warning(default : 4103) #pragma warning (default : 4103)
#elif defined __GNUC__ #elif defined __GNUC__
/* nothing to do */ /* nothing to do */
#elif defined _OS9000 #elif defined _OS9000
/* nothing to do */ /* nothing to do */
#else #else
#error CAUTION: set default structure alignment #error CAUTION: set default structure alignment
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment