/* * ******************************************** * * Licensed Materials - Property of IBM and/or HCL * * IBM Informix Dynamic Server * Copyright IBM Corporation 2009, 2016 * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved. * * ******************************************** */ #ifndef IAD_INSTANCE_H #define IAD_INSTANCE_H #include "API.h" /* Server Type definitions */ #define DR 0x0 #define ON 0x40 #define OL 0x80 #define SE 0xC0 #define GRP 0x100 /* Connection Type definitions */ #define IPC 0x0 #define SOC 0x10 #define SQL 0x20 #define TLI 0x30 /* Network Type definitions */ #define IMC 0x0 #define MUX 0x2 #define NMP 0x4 #define SHM 0x6 #define SPX 0x8 #define SSL 0xA #define STR 0xC #define TCP 0xE /* Define maximum length of server connection protocol */ #define PROTOCOL_LEN 8 /* enumeration type for different types of data spaces */ enum space_type { IAD_DBSPACE = 100, IAD_TEMPDBSPACE, IAD_SBSPACE, IAD_TEMPSBSPACE, /* TODO - extspace creation currently not supported */ /* IAD_EXTSPACE, */ IAD_BLOBSPACE }; /* enumeration type for mirror status */ enum mirror_status { IAD_MIRROR_OFF, IAD_MIRROR_ON }; /* enumeration type for tempspace status */ enum tmp_space_status { IAD_TEMPSPACE_OFF, IAD_TEMPSPACE_ON }; /* enumeration type for log type */ enum log_type { IAD_PHYSLOG = 0, IAD_LOGICALLOG }; /* Instance Configuration API */ /* Gets server environment information from memory. If environment information had not been written using iadSetEnvironment, value can't be retrieved Returns: IAD_E_NOERROR - success IAD_E_STRUCTURE_NOT_INITIALIZED - install structure is not initialized IAD_E_NULLPOINTER - current instance is null */ EXPORT int STDCALL iadGetEnvironment(install_t *inst, const char *variable, char **value); /* Writes server environment into memory so that it can be later deployed Returns: IAD_E_NOERROR - success IAD_E_STRUCTURE_NOT_INITIALIZED - install structure is not initialized IAD_E_MEMORY_ALLOCATION_FAILURE - could not allocate memory */ EXPORT int STDCALL iadSetEnvironment(install_t *inst, const char *variable, const char *value); /* Writes instance config file based on INFORMIXSERVER name * Creates .csh, .ksh for Unix * Creates .cmd file for Windows */ EXPORT int STDCALL iadWriteEnv(install_t *inst); /* ENUM Connection {TCP PIPE SHM ...} * populates the connection_list for inst! */ /* Support list of protocols Unix Windows onipcshm onipcstr onipcnmp ontlitcp onsoctcp onsoctcp onsocssl onsocssl ontlispx onsocimc ontliimc onsqlmux onsqlmux drsocssl drsocssl drsoctcp drsoctcp drtlitcp drtlitcp */ enum conn_dbtype { on = 1, ol = 1, dr }; enum conn_interface { ipc = 1, tli = 2, soc = 2, sql = 3 }; enum conn_network { shm = 1, str = 2, nmp = 3, spx = 4, imc = 5, ssl = 6, tcp = 7, mux = 8 }; /* retrieves a connection with the specified name/alias for the current instance servername: name/alias to look up line: pointer to the connection structure that was looked up. may be null if you do not want the pointer. not changed if alias is not found returns IAD_E_FAIL if no connections matched the specified name/alias returns IAD_E_NULLPOINTER if an instance has not been made current returns IAD_E_INVALID_PARAMETER if servername is null */ EXPORT int STDCALL iadGetConnection(install_t *inst, const char *servername, const connection_t **line); EXPORT int STDCALL iadAddConnection(install_t *inst, const char * alias, CPROTOCOL connection_type, const char *hostname, unsigned short port, const char *service_name, const char *options); /* Update services file (if failed, write port number when creating sqlhosts) * Create sqlhosts * unix, * Dump file to $INFORMIXSQLHOSTS or $INFORMIXDIR/etc/sqlhosts as specified * in the environment * windows * write sqlhosts to registery. */ EXPORT int STDCALL iadWriteConnection(install_t *inst); /* Read a sqlhosts file into the connection_list */ EXPORT int STDCALL iadReadConnections(install_t *inst, const char *file); #ifdef WIN32 /* * sqlhost can be "\\machine" for remote registery NULL for local registery * and a file name for file */ EXPORT int STDCALL iadWindowsReadConnections(install_t *is, const char *sqlhost); /* * reghost can be "\\machine" for remote registery NULL for local registery */ EXPORT int STDCALL iadReadConnectionsRegistery(install_t *is, const char *reghost); #endif /* WIN32 */ /* Converts a protocol flag into a corresponding protocol string For example: iadMapProtocol(ON|SOC|TCP) returns "onsoctcp" */ EXPORT char * STDCALL iadMapProtocol(CPROTOCOL); /* Converts a string into a corresponding protocol flag that can be tested. For example: iadMapStringToProtocol("onsoctcp") returns (ON|SOC|TCP) */ EXPORT CPROTOCOL STDCALL iadMapStringtoProtocol(char *proto); /* Changes a config pramater, */ EXPORT int STDCALL iadSetConfig(install_t *inst, const char *label, const char *value, const char *comment); /* adds a config pramater, for use with pramaters that can be specified twice */ EXPORT int STDCALL iadAddConfig(install_t *inst, const char *label, const char *value, const char *comment); /* Dump file to $INFORMIXDIR/etc/$ONCONFIG specified in the environment */ EXPORT int STDCALL iadWriteConfig(install_t *inst); EXPORT int STDCALL iadReadConfig(install_t *inst, const char *file); /* Reads server configuration information from the configLines structure. This function reads information added to the configLines structure using iadSetConfig() or iadAddConfig() */ EXPORT int STDCALL iadGetConfig(install_t *inst, const char *label, char **value, configLines_t **cfg_out); /* Instance Control API */ /* State could be quiescient, multi-user, single-user, blocked, unblocked */ /* Options could be verbose mode or other supported feature */ EXPORT int STDCALL iadInitInstance(install_t *inst, int options); EXPORT int STDCALL iadStartInstance(install_t *inst, int options); /* StopInstance() Stops the instances input: nstall_t *installStructure, char *InstanceName, return codes: IAD_E_NOERROR when there are no errors. IAD_E_FAIL when function fails */ EXPORT int STDCALL iadStopInstance(install_t *is, const char *instance); /* iadRemoveInstance() Removes the chunk files, environment files, message logs Input: install_t *installStructure char *InstanceName return codes: IAD_E_NOERROR when there are no errors. IAD_E_FAIL when the function fails. */ EXPORT int STDCALL iadRemoveInstance(install_t *inst, const char *instance); /* iadRemoveInstallationInstances() Removes all of the instances from a given installation location Input: install_t *installStructure, char *infxDir - path to remove instances from return codes: IAD_E_NOERROR when there are no errors. IAD_E_FAIL when the function fails */ EXPORT int STDCALL iadRemoveInstallationInstances(install_t *is, const char *infxDir); EXPORT int STDCALL iadChangeMode(install_t *inst, int state, int options); EXPORT int STDCALL iadGetInstanceStatus (install_t *inst); /* Space Provisioning API */ EXPORT int STDCALL iadCreateDBSpace( install_t *inst, const char *name, const char *path, const char *size, const char *offset, const char *pagesize, const char *mirrorpath, const char *mirroroffset, const char *f_extsize, const char *n_extsize, int tmp_dbs_flg ); /*if tmp_dbs_flg is set, DBSPACETEMP config param must*/ /*be set to the temp dbspace name*/ /*This must be done before the server is started*/ EXPORT int STDCALL iadCreateSBSpace( install_t *is, const char *name, const char *path, const char *size, const char *offset, const char *mirrorpath, const char *mirroroffset, const char *metadataoffset, const char *metadatasize, int tmp_sbs_flg, const char *def_specs ); /* update ONCONFIG sbspace, syssbspace with first sbspace created */ /* TODO - currently not supported by IDS Admin API */ /* EXPORT int STDCALL iadCreateEXTSpace( install_t *is, const char *name, const char *path, const char *size, const char *offset ); */ EXPORT int STDCALL iadCreateBLOBSpace( install_t *is, const char *name, const char *path, const char *size, const char *offset, unsigned int pageunit, const char *mirrorpath, const char *mirroroffset ); EXPORT int STDCALL iadCreateSpace( install_t *is, int type, const char *name, const char *path, const char *size, const char *offset ); /* create dbspace files, change permissions. * create links to dbspace files under $INFORMIXDIR/... * create admin api sql */ EXPORT int STDCALL iadCreateMirrorSpace( install_t *is, const char *name, const char *mirrorpath, const char *mirroroffset ); EXPORT int STDCALL iadDeploySpaces(install_t *inst); EXPORT int STDCALL iadDeployDemoInstance(install_t *inst); char *randomString(char *dst, int size); /* Move logical logs from rootdbs to named dbspace * Move Physical log to named dbspace from any dbspace. * If no logs are left in the root dbspace add new Logs. */ EXPORT int STDCALL iadCreateLog( install_t *inst, int logtype, const char *targetspace, unsigned int number, const char *size ); /* Deploy logs using information in log struct */ EXPORT int STDCALL iadDeployLogs(install_t *inst); char *map_protocol(CPROTOCOL proto); EXPORT int STDCALL iadInitInstanceStruct(install_t *inst); EXPORT int STDCALL iadDeployJsonListenerFile(install_t *is); EXPORT int STDCALL iadOpenSysadminInDeploy(install_t *is); EXPORT int STDCALL iadCloseSysadminInDeploy(install_t *is); EXPORT int STDCALL iadGrantDBAonLocalInstance(install_t *is); #endif /* IAD_INSTANCE_H */