6 #ifndef OPENER_OPENER_API_H_ 
    7 #define OPENER_OPENER_API_H_ 
   15 #include "opener_user_conf.h" 
  146                           const int number_of_class_attributes,
 
  147                           const EipUint32 highest_class_attribute_number,
 
  148                           const int number_of_class_services,
 
  149                           const int number_of_instance_attributes,
 
  150                           const EipUint32 highest_instance_attribute_number,
 
  151                           const int number_of_instance_services,
 
  152                           const int number_of_instances,
 
  176   CipClass *RESTRICT 
const cip_object_to_add_instances,
 
  177   const int number_of_instances);
 
  211                      void *
const cip_data,
 
  245                    char *
const service_name);
 
  259                const void *
const cip_data,
 
  275                void *
const cip_data,
 
  276                const EipUint8 **
const cip_message);
 
  382   const unsigned int connection_number,
 
  383   const unsigned int output_assembly_id,
 
  384   const unsigned int input_assembly_id,
 
  385   const unsigned int configuration_assembly_id);
 
  401   const unsigned int connection_number,
 
  402   const unsigned int output_assembly_id,
 
  403   const unsigned int input_assembly_id,
 
  404   const unsigned int configuration_assembly_id);
 
  420   const unsigned int connection_number,
 
  421   const unsigned int output_assembly_id,
 
  422   const unsigned int input_assembly_id,
 
  423   const unsigned int configuration_assembly_id);
 
  442                                  int *number_of_remaining_bytes,
 
  462                                  const struct sockaddr_in *from_address,
 
  464                                  const size_t buffer_length,
 
  465                                  int *number_of_remaining_bytes,
 
  483                             int received_data_length,
 
  484                             struct sockaddr_in *from_address);
 
  523                    unsigned int input_assembly_id);
 
  578                             unsigned int input_assembly_id,
 
  645 void *
CipCalloc(
size_t number_of_elements,
 
  646                 size_t size_of_element);
 
  683                     struct sockaddr_in *socket_data,
 
EipStatus ApplicationInitialization(void)
Callback for the application initialization. 
void InsertAttribute(CipInstance *const cip_instance, const EipUint16 attribute_number, const EipUint8 cip_data_type, void *const cip_data, const EipByte cip_flags)
Insert an attribute in an instance of a CIP class. 
void CloseSession(int socket_handle)
Inform the encapsulation layer that the remote host has closed the connection. 
CipInstance * CreateAssemblyObject(const EipUint32 instance_number, EipByte *const data, const EipUint16 data_length)
Create an instance of an assembly object. 
void(* ConnectionTimeoutFunction)(CipConnectionObject *connection_object)
Function prototype for handling the timeout of connections. 
EipStatus SendUdpData(struct sockaddr_in *socket_data, int socket_handle, EipUint8 *data, EipUint16 data_length)
Create a producing or consuming UDP socket. 
void(* InitializeCipClass)(CipClass *)
CipClass * CreateCipClass(const EipUint32 class_id, const int number_of_class_attributes, const EipUint32 highest_class_attribute_number, const int number_of_class_services, const int number_of_instance_attributes, const EipUint32 highest_instance_attribute_number, const int number_of_instance_services, const int number_of_instances, char *name, const EipUint16 revision, InitializeCipClass initializer)
Allocate memory for new CIP Class and attributes. 
EipStatus(* CipServiceFunction)(CipInstance *const instance, CipMessageRouterRequest *const message_router_request, CipMessageRouterResponse *const message_router_response, struct sockaddr *originator_address, const int encapsulation_session)
Signature definition for the implementation of CIP services. 
void SetDeviceSerialNumber(const EipUint32 serial_number)
Set the serial number of the device's identity object. 
int HandleReceivedExplictUdpData(const int socket_handle, const struct sockaddr_in *from_address, const EipUint8 *buffer, const size_t buffer_length, int *number_of_remaining_bytes, bool unicast, ENIPMessage *const outgoing_message)
Notify the encapsulation layer that an explicit message has been received via UDP. 
Class is a subclass of Instance. 
EipStatus(* OpenConnectionFunction)(CipConnectionObject *RESTRICT const connection_object, EipUint16 *const extended_error_code)
Function prototype for handling the opening of connections. 
UdpCommuncationDirection
Communication direction of an UDP socket; consuming is receiver, producing is sender. 
EipStatus AddConnectableObject(const EipUint32 class_id, OpenConnectionFunction open_connection_function)
register open functions for an specific object. 
size_t CalculateIndex(EipUint16 attribute_number)
Calculates Byte-Index of Attribute. 
CipInstance * AddCIPInstance(CipClass *RESTRICT const cip_class_to_add_instance, const EipUint32 instance_id)
Create one instance of a given class with a certain instance number. 
void CheckIoConnectionEvent(unsigned int output_assembly_id, unsigned int input_assembly_id, IoConnectionEvent io_connection_event)
Inform the application on changes occurred for a connection. 
void * CipCalloc(size_t number_of_elements, size_t size_of_element)
Allocate memory for the CIP stack. 
void ConfigureListenOnlyConnectionPoint(const unsigned int connection_number, const unsigned int output_assembly_id, const unsigned int input_assembly_id, const unsigned int configuration_assembly_id)
Configures the connection point for a listen only connection. 
EipStatus
EIP stack status enum. 
void InsertService(const CipClass *const cip_class_to_add_service, const EipUint8 service_code, const CipServiceFunction service_function, char *const service_name)
Insert a service in an instance of a CIP object. 
void HandleApplication(void)
Allow the device specific application to perform its execution. 
EipStatus ResetDevice(void)
Emulate as close a possible a power cycle of the device. 
void ConfigureMacAddress(const char *network_interface)
Configure the MAC address of the device. 
void ConfigureInputOnlyConnectionPoint(const unsigned int connection_number, const unsigned int output_assembly_id, const unsigned int input_assembly_id, const unsigned int configuration_assembly_id)
Configures the connection point for an input only connection. 
EipStatus AfterAssemblyDataReceived(CipInstance *instance)
Call back function to inform application on received data for an assembly object. ...
EipStatus ManageConnections(MilliSeconds elapsed_time)
Check if any of the connection timers (TransmissionTrigger or WatchdogTimeout) have timed out...
int DecodeData(const EipUint8 cip_data_type, void *const cip_data, const EipUint8 **const cip_message)
Retrieve the given data according to CIP encoding from the message buffer. 
EipStatus TriggerConnections(unsigned int output_assembly_id, unsigned int input_assembly_id)
Trigger the production of an application triggered connection. 
void CipFree(void *data)
Free memory allocated by the OpENer. 
void ConfigureExclusiveOwnerConnectionPoint(const unsigned int connection_number, const unsigned int output_assembly_id, const unsigned int input_assembly_id, const unsigned int configuration_assembly_id)
Configures the connection point for an exclusive owner connection. 
int EncodeData(const EipUint8 cip_data_type, const void *const cip_data, EipUint8 **cip_message)
Produce the data according to CIP encoding onto the message buffer. 
void CipStackInit(const EipUint16 unique_connection_id)
Initialize and setup the CIP-stack. 
CipInstance * GetCipInstance(const CipClass *RESTRICT const cip_object, const EipUint32 instance_number)
Get a pointer to an instance. 
EipStatus(* ConnectionSendDataFunction)(CipConnectionObject *connection_object)
Function prototype for sending data via a connection. 
CipClass * GetCipClass(const EipUint32 class_id)
Get a pointer to a CIP object with given class code. 
CipAttributeStruct * GetCipAttribute(const CipInstance *const cip_instance, const EipUint16 attribute_number)
Get a pointer to an instance's attribute. 
uint8_t EipByte
EIP Data type definitions. 
EipStatus ConfigureNetworkInterface(const char *const network_interface)
Configure the data of the network interface of the device. 
EipStatus ResetDeviceToInitialConfiguration(void)
Reset the device to the initial configuration and emulate as close as possible a power cycle of the d...
void ShutdownCipStack(void)
Shutdown of the CIP stack. 
void RunIdleChanged(EipUint32 run_idle_value)
Inform the application that the Run/Idle State has been changed by the originator. 
unsigned long MilliSeconds
int CreateUdpSocket(UdpCommuncationDirection communication_direction, struct sockaddr_in *socket_data, CipUsint qos_for_socket)
create a producing or consuming UDP socket 
void SetDeviceStatus(const EipUint16 device_status)
Set the current status of the device. 
void ConfigureDomainName(void)
Configure the domain name of the device. 
EipStatus HandleReceivedConnectedData(const EipUint8 *const received_data, int received_data_length, struct sockaddr_in *from_address)
Notify the connection manager that data for a connection has been received. 
void AllocateAttributeMasks(CipClass *target_class)
Allocates Attribute bitmasks. 
void CloseSocket(const int socket_handle)
Close the given socket and clean up the stack. 
CipInstance * AddCipInstances(CipClass *RESTRICT const cip_object_to_add_instances, const int number_of_instances)
Add a number of CIP instances to a given CIP class. 
EipBool8 BeforeAssemblyDataSend(CipInstance *instance)
Inform the application that the data of an assembly object will be sent. 
struct sockaddr_in originator_address
int HandleReceivedExplictTcpData(int socket_handle, EipUint8 *buffer, size_t length, int *number_of_remaining_bytes, struct sockaddr *originator_address, ENIPMessage *const outgoing_message)
Notify the encapsulation layer that an explicit message has been received via TCP. 
void(* ConnectionCloseFunction)(CipConnectionObject *connection_object)
Function prototype for handling the closing of connections. 
EipStatus(* ConnectionReceiveDataFunction)(CipConnectionObject *connection_object, const EipUint8 *data, const EipUint16 data_length)
Function prototype for receiving data via a connection. 
void ConfigureHostName(void)
Configure the host name of the device.