Function : CAI_createConversationFactory_SI |
Description |
This function creates a new Conversation factory and replaces the CAI_createConversationFactory function.
The connection input structure has been expanded to support several IP adresses and ports (compared to only one with the CAI_createConversationFactory)
The support for several {IP,port} is linked to the Amadeus migration to the Service Integrator (SI).
Currently the recommanded way to create a conversation factory is to use the CAI_createConversationFactory_SI function and specify an array of 1 element (APIv2 gateway adress and port).
See details and benefits of using SI migration here
API : Application Programming Interface |
|
Field Descriptions |
Parameter | In/Out | Description |
---|---|---|
in_connection | In |
A pointer to a structure in which the TCP/IP parameters used for the connection
to the Amadeus host are stored. In order to handle several connection points, this structure allows for an array of TCP/IP connection entry points. |
in_authentication | In | A pointer to a structure containing the APIv2 authentication parameters. |
o_factory | Out | A reference to a pointer to the factory that is being created. The pointer (*o_factory) must be initialized to NULL. |
Structure Definition |
#define CAS_TCP_ADDRESS_MAX (10) #define CAS_TCP_SERVER_MAX (32) typedef enum { CAI_CONNECTION_TYPE_V2 =0, CAI_CONNECTION_TYPE_SI } CAI_Connection_Type_SI; typedef struct { unsigned char tcp_server[CAS_TCP_SERVER_MAX]; unsigned int port_number; } CAI_Address; typedef struct { CAI_Connection_Type_SI tcp_connection_type; unsigned int tcp_connection_nb; CAI_Address tcp_connections[CAS_TCP_ADDRESS_MAX]; } CAI_Connection_SI; |
tcp_connection_type (CAI_Connection_Type_SI) is an enumerated type describing the connection type of the structure:
Note: It is easy to see here that the CAI_Connection structure can be expressed as a CAI_Connection_SI structure with:
corporate_id is the corporate identifier. user_id is the user identifier. password is the password of the user.
typedef struct { unsigned char *corporate_id; unsigned char *user_id; unsigned char *password; } CAI_Authentication; |
Example |
CaiErr cai_err = CAI_OK; CAI_CustomSign customsign; CAI_Connection_SI connection; CAI_Authentication authentication; CAI_ConversationFactory *factory = NULL; CAI_initConnection_SI(&connection); CAI_initAuthentication(&authentication); connection.tcp_connection_type = CAI_CONNECTION_TYPE_V2; connection.tcp_connection_nb = 1; strcpy(connection.tcp_connections[0].tcp_server, "123.123.123.123"); connection.tcp_connections[0].port_number = 12345; authentication.corporate_id= (unsigned char *) "AMADEUS"; authentication.user_id= (unsigned char *) "AMADEUS"; authentication.password= (unsigned char *) "AMADEUS"; printf("Creating the conversation Factory ...\n"); cai_err = CAI_createConversationFactory_SI(&connection, &authentication, &factory); |
Note: a CAI_getConnectionInfoFromINI(iniFile,&connection) function is provided by API in order to externalize the connection parameters definition in a .INI file. When full migration to the Amadeus SI occurs, no code changes (only .ini file update) will be required.
CAI_getConnectionInfoFromINI(char * ini_name, CAI_Connection_SI *connection); |
CaiErr cai_err = CAI_OK; CAI_CustomSign customsign; CAI_Connection_SI connection; CAI_Authentication authentication; CAI_ConversationFactory *factory = NULL; char iniFile = (char*)"v2.ini"; CAI_initConnection_SI(&connection); CAI_initAuthentication(&authentication); cai_err = CAI_getConnectionInfoFromINI(iniFile,&connection); authentication.corporate_id= (unsigned char *) "AMADEUS"; authentication.user_id= (unsigned char *) "AMADEUS"; authentication.password= (unsigned char *) "AMADEUS"; printf("Creating the conversation Factory ...\n"); cai_err = CAI_createConversationFactory_SI(&connection, &authentication, &factory); |
Click here for INI file samples