libtase2  2.4.0
TASE.2/ICCP Protocol Source Code Library for C/C++
Loading...
Searching...
No Matches
tase2_endpoint.h
Go to the documentation of this file.
1/*
2 * tase2_endpoint.h
3 *
4 * This file is part of libtase2
5 *
6 * Copyright 2017-2023 Michael Zillgith
7 *
8 * All rights reserved.
9 */
10
11#ifndef TASE2_ENDPOINT_H_
12#define TASE2_ENDPOINT_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
19#include "tls_config.h"
20#include "asecurity.h"
21
27typedef struct sTase2_BilateralTable* Tase2_BilateralTable;
28
32typedef struct sTase2_Endpoint* Tase2_Endpoint;
33
37typedef struct sTase2_Endpoint_Connection* Tase2_Endpoint_Connection;
38
66
84
88typedef struct sTase2_Client* Tase2_Client;
89
93typedef struct sTase2_Server* Tase2_Server;
94
100typedef struct
101{
102 uint8_t size;
103 uint8_t value[16];
105
111typedef struct
112{
113 uint8_t size;
114 uint8_t value[16];
116
122typedef struct
123{
124 uint8_t size;
125 uint8_t value[16];
127
128typedef struct sTase2_ApplicationAddress* Tase2_ApplicationAddress;
129
144
152typedef void (*Tase2_Endpoint_StateChangedHandler) (Tase2_Endpoint endpoint, void* parameter, Tase2_Endpoint_State newState);
153
162typedef void (*Tase2_Endpoint_ConnectionHandler) (Tase2_Endpoint endpoint, void* parameter, Tase2_Endpoint_Connection connection, bool connect);
163
172TASE2_API Tase2_Endpoint
174
182TASE2_API bool
184
193TASE2_API void
195
204TASE2_API void
206
215TASE2_API void
216Tase2_Endpoint_setALSConfiguration(Tase2_Endpoint self, ASecurityConfiguration secConfig);
217
225TASE2_API void
227
235TASE2_API void
237
258
271typedef bool (*Tase2_Endpoint_ConnectionAcceptHandler) (Tase2_Endpoint endpoint, void* parameter, const char* peerAddress, Tase2_BilateralTable clientBlt,
272 Tase2_AuthenticationMethod authType, uint8_t* authValue, int authValLen);
273
283TASE2_API void
285
304typedef ASecurityConfiguration (*Tase2_Endpoint_ALSConfigurationProvider) (Tase2_Endpoint endpoint, void* parameter, const char* peerAddress,
305 Tase2_ApplicationAddress localApAddr, Tase2_ApplicationAddress remoteApAddr);
306
314TASE2_API void
316
327TASE2_API void
328Tase2_Endpoint_setAddressMatchingRules(Tase2_Endpoint self, bool apTitle, bool aeQualifier, bool pSelector, bool sSelector, bool tSelector);
329
339TASE2_API void
340Tase2_Endpoint_setIdentity(Tase2_Endpoint self, const char* vendor, const char* model, const char* revision);
341
352TASE2_API Tase2_ApplicationAddress
354
363TASE2_API void
364Tase2_Endpoint_setLocalApTitle(Tase2_Endpoint self, const char* apTitle, int aeQualifier);
365
375TASE2_API void
377
385TASE2_API void
387
397TASE2_API void
399
407TASE2_API void
409
417TASE2_API void
419
427TASE2_API void
429
437TASE2_API void
439
440
451TASE2_API Tase2_ApplicationAddress
453
462TASE2_API void
463Tase2_Endpoint_setRemoteApTitle(Tase2_Endpoint self, const char* apTitle, int aeQualifier);
464
474TASE2_API void
476
484TASE2_API void
486
496TASE2_API void
498
506TASE2_API void
508
516TASE2_API void
518
526TASE2_API void
528
536TASE2_API void
538
548TASE2_API void
550
559TASE2_API void
561
570TASE2_API void
572
581TASE2_API void
583
592TASE2_API void
594
603TASE2_API void
605
609TASE2_API void
611
615TASE2_API void
616Tase2_Endpoint_disconnect(Tase2_Endpoint self, int disconnectMethod);
617
625TASE2_API void
626Tase2_Endpoint_disconnectPeer(Tase2_Endpoint self, const char* peerIpAddress);
627
634TASE2_API bool
636
642TASE2_API int
644
653TASE2_API bool
655
663TASE2_API Tase2_Endpoint_State
665
673TASE2_API void
675
683TASE2_API Tase2_Server
685
686
694TASE2_API Tase2_Client
696
702TASE2_API void
704
715TASE2_API const char*
717
725TASE2_API void
727
740TASE2_API char*
742
753TASE2_API char*
755
765TASE2_API Tase2_TSelector*
767
777TASE2_API Tase2_SSelector*
779
789TASE2_API Tase2_PSelector*
791
797TASE2_API int
799
805TASE2_API int
807
810#ifdef __cplusplus
811}
812#endif
813
814#endif /* TASE2_ENDPOINT_H_ */
struct sTLSConfiguration * TLSConfiguration
Definition tls_config.h:38
TASE2_API void Tase2_Endpoint_setLocalTcpPort(Tase2_Endpoint self, int tcpPort)
Sets the local TCP port (only for passive mode)
TASE2_API void Tase2_Endpoint_setRemoteIpAddress(Tase2_Endpoint self, const char *ipAddress)
Sets the remote IP address (only for active mode)
TASE2_API void Tase2_Endpoint_destroy(Tase2_Endpoint self)
Delete the endpoint and release all resources.
TASE2_API Tase2_Client Tase2_Endpoint_removeClient(Tase2_Endpoint self, Tase2_Client client)
Remove a client from the endpoint.
ASecurityConfiguration(* Tase2_Endpoint_ALSConfigurationProvider)(Tase2_Endpoint endpoint, void *parameter, const char *peerAddress, Tase2_ApplicationAddress localApAddr, Tase2_ApplicationAddress remoteApAddr)
Callback handler to provide a connection specific ASecurityConfiguration instance for ALS setup.
Definition tase2_endpoint.h:304
TASE2_API void Tase2_Endpoint_disconnect(Tase2_Endpoint self, int disconnectMethod)
Disconnect (close all connections and stop listening for new connections)
void(* Tase2_Endpoint_ConnectionHandler)(Tase2_Endpoint endpoint, void *parameter, Tase2_Endpoint_Connection connection, bool connect)
Callback function is called when another endpoint is connected or diconnected to the local endpoint.
Definition tase2_endpoint.h:162
TASE2_API void Tase2_Endpoint_setLocalIpAddress(Tase2_Endpoint self, const char *ipAddress)
Sets the local IP address (only for passive mode)
TASE2_API Tase2_Server Tase2_Endpoint_removeServer(Tase2_Endpoint self, Tase2_Server server)
Remove a server from the endpoint.
TASE2_API void Tase2_Endpoint_setLocalAddresses(Tase2_Endpoint self, Tase2_PSelector pSelector, Tase2_SSelector sSelector, Tase2_TSelector tSelector)
Sets the local addresses for ISO layers (transport, session, presentation)
TASE2_API Tase2_ApplicationAddress Tase2_Endpoint_getRemoteApplicationAddress(Tase2_Endpoint self)
Get the default remote application address instance.
Tase2_AuthenticationMethod
Authentication mechanism used by peer.
Definition tase2_endpoint.h:242
TASE2_API void Tase2_Endpoint_setRemoteApTitleEx(Tase2_Endpoint self, const char *apTitle)
Set remote AP-title (for active endpoint)
TASE2_API void Tase2_Endpoint_setConnectionHandler(Tase2_Endpoint self, Tase2_Endpoint_ConnectionHandler handler, void *parameter)
Set a handler that is called whenever a connection to a remote endpoint is opened or closed.
TASE2_API void Tase2_Endpoint_setALSConfigurationProvider(Tase2_Endpoint self, Tase2_Endpoint_ALSConfigurationProvider provider, void *parameter)
Set a ALS configuration provider. This enables the user to provide a connection specific ASecurityCon...
TASE2_API bool Tase2_Endpoint_isConnected(Tase2_Endpoint self)
Check if the endpoint is connected with at least one TCP client (passive endpoint) or connected to a ...
TASE2_API void Tase2_Endpoint_setLocalAeQualifier(Tase2_Endpoint self, int aeQualifier)
Set local AE-qualifier.
TASE2_API void Tase2_Endpoint_setMaxServOutstandingCalling(Tase2_Endpoint self, int value)
Set the maximum number of outstanding service calls.
TASE2_API void Tase2_Endpoint_setConnectTimeout(Tase2_Endpoint self, int timeoutInMs)
Sets the connect timeout of active endpoints.
TASE2_API void Tase2_Endpoint_setALSConfiguration(Tase2_Endpoint self, ASecurityConfiguration secConfig)
Set application layer security (ALS) configuration.
Tase2_ALS_Mode
Definition tase2_endpoint.h:68
TASE2_API Tase2_TSelector * Tase2_Endpoint_Connection_getPeerTSel(Tase2_Endpoint_Connection self)
Get the T selector of the peer.
TASE2_API void Tase2_Endpoint_setLocalApInvocationId(Tase2_Endpoint self, int apInvocationId)
Set local AP-invocation-ID.
TASE2_API char * Tase2_Endpoint_Connection_getPeerApTitle(Tase2_Endpoint_Connection self)
Get the ISO ACSE AP-title of the peer.
TASE2_API Tase2_PSelector * Tase2_Endpoint_Connection_getPeerPSel(Tase2_Endpoint_Connection self)
Get the P selector of the peer.
TASE2_API char * Tase2_Endpoint_Connection_getPeerIpAddress(Tase2_Endpoint_Connection self)
Get the address of the peer application (IP address and port number)
TASE2_API Tase2_ApplicationAddress Tase2_Endpoint_getLocalApplicationAddress(Tase2_Endpoint self)
Get the local application address instance.
TASE2_API int Tase2_Endpoint_Connection_getMaxPduSize(Tase2_Endpoint_Connection self)
Get the maximum MMS PDU size used by this connection.
TASE2_API Tase2_Endpoint_State Tase2_Endpoint_getState(Tase2_Endpoint self)
Get the current state of the endpoint.
bool(* Tase2_Endpoint_ConnectionAcceptHandler)(Tase2_Endpoint endpoint, void *parameter, const char *peerAddress, Tase2_BilateralTable clientBlt, Tase2_AuthenticationMethod authType, uint8_t *authValue, int authValLen)
Callback handler to accept/reject new connections.
Definition tase2_endpoint.h:271
TASE2_API void Tase2_Endpoint_setRemoteAeQualifier(Tase2_Endpoint self, int aeQualifier)
Set remote AE-qualifier (for active endpoint)
TASE2_API const char * Tase2_Endpoint_getId(Tase2_Endpoint self)
Get the ID string of the endpoint.
TASE2_API void Tase2_Endpoint_setRemoteTcpPort(Tase2_Endpoint self, int tcpPort)
Sets the remote TCP port (only for active mode)
TASE2_API void Tase2_Endpoint_setStateChangedHandler(Tase2_Endpoint self, Tase2_Endpoint_StateChangedHandler handler, void *parameter)
Set a handler that is called whenever the state of the endpoint changes.
Tase2_Endpoint_State
Definition tase2_endpoint.h:40
TASE2_API Tase2_Endpoint Tase2_Endpoint_create(TLSConfiguration tlsConfig, bool passive)
Create a new endpoint instance.
TASE2_API void Tase2_Endpoint_setAddressMatchingRules(Tase2_Endpoint self, bool apTitle, bool aeQualifier, bool pSelector, bool sSelector, bool tSelector)
Set the address matching rules for identifying peer endpoints.
struct sTase2_Endpoint_Connection * Tase2_Endpoint_Connection
Represents a connection to another connected TASE.2 endpoint.
Definition tase2_endpoint.h:37
TASE2_API void Tase2_Endpoint_setMaxMmsPduSize(Tase2_Endpoint self, int maxPduSize)
Sets the maximum MMS PDU size used by the endpoint.
TASE2_API void Tase2_Endpoint_setIdentity(Tase2_Endpoint self, const char *vendor, const char *model, const char *revision)
Set own identity for the identity service.
TASE2_API void Tase2_Endpoint_setId(Tase2_Endpoint self, const char *id)
Set the ID string of the endpoint.
TASE2_API void Tase2_Endpoint_setConnectionAcceptHandler(Tase2_Endpoint self, Tase2_Endpoint_ConnectionAcceptHandler handler, void *parameter)
Set the peer connection handler that is called when a peer tries to connect.
TASE2_API void Tase2_Endpoint_setWriteTimeout(Tase2_Endpoint self, int timeoutInMs)
Sets the timeout for writing to TCP sockets.
TASE2_API void Tase2_Endpoint_setLocalApTitle(Tase2_Endpoint self, const char *apTitle, int aeQualifier)
Set the local AP-title value.
TASE2_API void Tase2_Endpoint_setRemoteApInvocationId(Tase2_Endpoint self, int apInvocationId)
Set remote AP-invocation-ID (for active endpoint)
TASE2_API void Tase2_Endpoint_setALSMode(Tase2_Endpoint self, Tase2_ALS_Mode mode)
Set the ALS (application layer security) mode.
TASE2_API Tase2_SSelector * Tase2_Endpoint_Connection_getPeerSSel(Tase2_Endpoint_Connection self)
Get the S selector of the peer.
TASE2_API void Tase2_Endpoint_setRemoteApTitle(Tase2_Endpoint self, const char *apTitle, int aeQualifier)
Set remote AP-title and AE-qualifier (for active endpoint)
TASE2_API void Tase2_Endpoint_connect(Tase2_Endpoint self)
Connect the endpoint (start a passive or active TCP endpoint)
struct sTase2_Client * Tase2_Client
A TASE.2 client to communicate with a single TASE.2 server.
Definition tase2_endpoint.h:88
TASE2_API void Tase2_Endpoint_setLocalAeInvocationId(Tase2_Endpoint self, int aeInvocationId)
Set local AE-invocation-ID.
struct sTase2_BilateralTable * Tase2_BilateralTable
Definition tase2_endpoint.h:27
TASE2_API bool Tase2_Endpoint_waitForState(Tase2_Endpoint self, Tase2_Endpoint_State state, int timeoutInMs)
Wait until the endpoint enters a specific state of state changes to TASE2_ENDPOINT_STATE_ERROR.
TASE2_API void Tase2_Endpoint_setLocalApTitleEx(Tase2_Endpoint self, const char *apTitle)
Set local AP-title.
TASE2_API void Tase2_Endpoint_setRemoteAddresses(Tase2_Endpoint self, Tase2_PSelector pSelector, Tase2_SSelector sSelector, Tase2_TSelector tSelector)
Sets the remote addresses for ISO layers (transport, session, presentation)
void(* Tase2_Endpoint_StateChangedHandler)(Tase2_Endpoint endpoint, void *parameter, Tase2_Endpoint_State newState)
Callback function is called whenever the state of the endpoint changes.
Definition tase2_endpoint.h:152
TASE2_API void Tase2_Endpoint_addServer(Tase2_Endpoint self, Tase2_Server server)
Add a server to the endpoint.
TASE2_API void Tase2_Endpoint_setRemoteAeInvocationId(Tase2_Endpoint self, int aeInvocationId)
Set remote AE-invocation-ID (for active endpoint)
TASE2_API int Tase2_Endpoint_connectedPeers(Tase2_Endpoint self)
Get number of connected peers.
TASE2_API void Tase2_Endpoint_disconnectPeer(Tase2_Endpoint self, const char *peerIpAddress)
Disconnect a specific connection identified by the IP address and optionally by the port number.
TASE2_API int Tase2_Endpoint_Connection_getPeerAeQualifier(Tase2_Endpoint_Connection self)
Get the ISO ACSE AE-qualifier of the peer.
struct sTase2_Endpoint * Tase2_Endpoint
A TASE.2 endpoint that can be configured as passive (TCP server) or active (TCP client)
Definition tase2_endpoint.h:32
TASE2_API void Tase2_Endpoint_setTLSConfiguration(Tase2_Endpoint self, TLSConfiguration tlsConfig)
Set the TLS configuration.
TASE2_API void Tase2_Endpoint_setRequestTimeout(Tase2_Endpoint self, int timeoutInMs)
Sets the timeout for confirmed request messages.
struct sTase2_Server * Tase2_Server
Handle for a Tase2_Server instance (representing a TASE.2/MMS server)
Definition tase2_endpoint.h:93
TASE2_API bool Tase2_Endpoint_isPassive(Tase2_Endpoint self)
Check if endpoint is in passive mode.
TASE2_API void Tase2_Endpoint_setMaxServOutstandingCalled(Tase2_Endpoint self, int value)
Set the maximum number of outstanding service calls.
@ TASE2_AUTH_TYPE_PASSWORD
Definition tase2_endpoint.h:247
@ TASE2_AUTH_TYPE_NONE
Definition tase2_endpoint.h:244
@ TASE2_AUTH_TYPE_UNKNOWN
Definition tase2_endpoint.h:256
@ TASE2_AUTH_TYPE_TLS
Definition tase2_endpoint.h:253
@ TASE2_AUTH_TYPE_CERTIFICATE
Definition tase2_endpoint.h:250
@ TASE2_ALS_MODE_UNSECURE
Definition tase2_endpoint.h:72
@ TASE2_ALS_MODE_BOTH
Definition tase2_endpoint.h:77
@ TASE2_ALS_MODE_SECURE
Definition tase2_endpoint.h:82
@ TASE2_ENDPOINT_STATE_IDLE
Definition tase2_endpoint.h:44
@ TASE2_ENDPOINT_STATE_ERROR
Definition tase2_endpoint.h:64
@ TASE2_ENDPOINT_STATE_LISTENING
Definition tase2_endpoint.h:49
@ TASE2_ENDPOINT_STATE_CONNECTED
Definition tase2_endpoint.h:54
@ TASE2_ENDPOINT_STATE_CONNECTING
Definition tase2_endpoint.h:59
ITU (International Telecommunication Union) object identifier (OID)
Definition iso_connection_parameters.h:32
P selector (ISO presentation layer address)
Definition tase2_endpoint.h:123
uint8_t size
Definition tase2_endpoint.h:124
S selector (ISO session layer address)
Definition tase2_endpoint.h:112
uint8_t size
Definition tase2_endpoint.h:113
T selector (ISO transport layer address)
Definition tase2_endpoint.h:101
uint8_t size
Definition tase2_endpoint.h:102
Definition tase2_endpoint.h:131
unsigned int hasApInvocationId
Definition tase2_endpoint.h:134
int aeQualifier
Definition tase2_endpoint.h:137
unsigned int hasAeInvocationId
Definition tase2_endpoint.h:133
Tase2_TSelector tSelector
Definition tase2_endpoint.h:142
Tase2_SSelector sSelector
Definition tase2_endpoint.h:141
ItuObjectIdentifier apTitle
Definition tase2_endpoint.h:136
int apInvocationId
Definition tase2_endpoint.h:139
int aeInvocationId
Definition tase2_endpoint.h:138
Tase2_PSelector pSelector
Definition tase2_endpoint.h:140
unsigned int hasAeQualifier
Definition tase2_endpoint.h:132
TLS API functions.