123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119 |
- /**************************************************************************
- *
- * Licensed Materials - Property of IBM and/or HCL and/or HCL
- *
- * IBM Informix Dynamic Server
- * Copyright IBM Corporation 2009-2017. All rights reserved.
- * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
- *
- * Product : Install API
- * Title : API.h
- * Description : Main include file for the install API.
- *
- ************************************************************************
- */
- #ifndef API_API_INCLUDED
- #define API_API_INCLUDED
- #include <stdio.h>
- #include <sys/types.h>
- #define IAD_RC(rc) rc,__FILE__,__LINE__
- #ifndef WIN32
- #define EXPORT extern
- #define STDCALL
- #define MS 1
- #define SEP '/' /* move to global internal header */
- #define bycopy(s1, s2, n) memmove(s2, s1, n)
- #define MKDIR(a,b) mkdir(a,b)
- #include <pwd.h>
- #ifdef NOT_DEFINED
- #include <shadow.h>
- #endif
- #include <grp.h>
- #else /* WIN32 */
- #define SEP '\\' /* move to global internal header */
- #define bycopy(s1, s2, n) memcpy(s2, s1, n)
- #define MKDIR(a,b) _mkdir(a)
- #define COBJMACROS
- #include <windows.h>
- #include <lm.h>
- #include <ntsecapi.h>
- #ifdef DLL
- #define EXPORT __declspec(dllexport)
- #else
- #define EXPORT __declspec(dllimport)
- #endif /* DLL */
- #define STDCALL __stdcall
- #define fork _fork
- #define MS 1000
- #define SZMAX_REG_STR 300
- #endif /* WIN32 */
- #include "ifxtypes.h"
- #ifdef DISCOVERY_ENABLED
- #include "../rsam/ipia.h"
- #endif
- #include "htrace.h"
- #define MAX_NAME 255
- #define MAX_LINE 255
- #define IAD_MAX_MSGSIZE 512
- #define MIN_LOGCOUNT 3 /* move to global internal header */
- #define KB (1024)
- #define MB (1024*1024)
- #define GB (1024*1024*1024)
- #define TB (1024*1024*1024*1024)
- #define PB (1024*1024*1024*1024*1024)
- #ifndef MIN
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
- #endif
- #ifndef MAX
- #define MAX(a,b) ((a) > (b) ? (a) : (b))
- #endif
- #define IAD_MAGIC_NUMBER 0x58494144
- #define IAD_BADMAGIC(is) (is && is->magic_number != IAD_MAGIC_NUMBER)
- #define IAD_GOODMAGIC(is) (is && is->magic_number == IAD_MAGIC_NUMBER)
- #define SVCST_UNINITIALIZED 0 /* needs to be zero */
- #define SVCST_CLEAN 1
- #define SVCST_DIRTY 2
- #define PORT_FREE 0
- #define PORT_USED 1
- #define PORT_CLAIMED 2
- #define ANY_PORT 0
- #define NAME_FREE 0
- #define NAME_USED 1
- #define RETURN_FILENAME 1
- #define RETURN_PATHNAME 2
- #define SHMKEY 0x52564801
- #define IAD_MAX_AUTOCFG_NUM (50)
- typedef long cpointer;
- /* typedef connection protocol */
- typedef unsigned int CPROTOCOL;
- enum IAD_BOOLEAN {
- IAD_FALSE,
- IAD_TRUE
- };
-
- typedef enum
- {
- IAD_PRODID_BUNDLE = 1,
- IAD_PRODID_IDS = 2,
- IAD_PRODID_CSDK = 3,
- IAD_PRODID_CONN = 4,
- IAD_PRODID_GLS = 5,
- IAD_PRODID_PSM = 6,
- IAD_PRODID_JDBC = 7,
- IAD_PRODID_IWA = 8,
- IAD_PRODID_MAX = 9
- } PRODUCT_ID;
- enum iad_method {
- IAD_METHOD_DFT = 0,
- IAD_METHOD_NUM = 1,
- IAD_METHOD_PCT = 2
- };
- typedef enum
- {
- IAD_REG_DEFAULT = 0,
- IAD_REG_32,
- IAD_REG_64
- } iad_registery_view;
- typedef enum {
- UNITS_KB = 0,
- UNITS_MB = 1,
- UNITS_GB = 2,
- UNITS_TB = 3,
- UNITS_PB = 4
- } diskmem_unittype;
- typedef enum {
- IAD_FILE = 0,
- IAD_LOCAL,
- IAD_REMOTE
- } sqlhost_locations_type;
- typedef struct {
- diskmem_unittype unit_type;
- char unit_charid;
- char unit_abbrev[3];
- char unit_name[10];
- long kb_convertfac;
- } unittype_tab;
- extern unittype_tab diskmem_units[5];
- enum install_mode
- {
- IAD_MODE_INSTALL = 0x0,
- IAD_MODE_UNINSTALL = 0x00000001,
- IAD_MODE_PRIVATE = 0x00000002,
- IAD_MODE_MAINTAIN = 0x00000004,
- IAD_MODE_NOSQL = 0x00000008
- };
- enum install_type
- {
- IAD_TYPE_TYPICAL = 0x00000001, /* Typical Installation */
- IAD_TYPE_CUSTOM = 0x00000002 /* Custom Installation */
- };
- enum space_deploy_status
- {
- space_not_deployed,
- space_deployed
- };
- enum install_deploy_status
- {
- IAD_SERVER_STATUS_CONFIG = 0,
- IAD_SERVER_STATUS_DEPLOYED = 1,
- IAD_SERVER_STATUS_ONLINE = 2
- };
- enum genconfig_status
- {
- IAD_GENCONFIG_INIT = 0,
- IAD_GENCONFIG_CALCULATING = 1,
- IAD_GENCONFIG_COMPLETE = 2,
- IAD_GENCONFIG_DEFAULT = 3
- };
- enum iad_install_string
- {
- IAD_INSTANCE_NAME_BASE = 0,
- IAD_CIA_NAME = 1,
- IAD_CIA_FULLNAME = 2,
- IAD_INFOCENTER_URL = 3,
- IAD_INFOCENTER_NAME = 4,
- IAD_BUILD_DATE = 5,
- IAD_BUILD_TIME = 6
- };
- #ifdef WIN32
- /* Predefined Windows registry hives */
- typedef enum
- {
- /* functional formating use tab not space */
- IAD_HKEY_CLASSES_ROOT = 0,
- IAD_HKEY_CURRENT_CONFIG,
- IAD_HKEY_CURRENT_USER,
- IAD_HKEY_LOCAL_MACHINE,
- IAD_HKEY_PERFORMANCE_DATA,
- IAD_HKEY_USERS
- } IAD_HKEY;
- typedef struct reg_data IAD_REGDATA;
- typedef struct reg_subkeys IAD_REGSUBKEYS;
- /* structure to hold registry key value/type/data information */
- struct reg_data
- {
- DWORD index;
- TCHAR *value;
- DWORD type;
- TCHAR *data;
- struct reg_data *next;
- };
- /* structure to hold registry key subkeys information */
- struct reg_subkeys
- {
- DWORD index;
- TCHAR *keyname;
- struct reg_subkeys *next;
- };
- #endif
- typedef struct install install_t;
- typedef struct iad_space iad_space_t;
- typedef struct status
- {
- int event_counter;
- int total_events;
- int (*setStatus) (install_t* status);
- /* jni specific */
- #ifndef WIN32
- void *env;
- void *a;
- #else
- install_t ** pData;
- DWORD dwThreadId;
- HANDLE hThread;
- #endif
- } status_t;
- typedef struct blank_line
- {
- char dummy;
- } blank_line_t;
- typedef struct comment_line
- {
- char *comment;
- } comment_line_t;
- typedef struct environment_line
- {
- char *variable;
- char *value;
- } environment_line_t;
- typedef struct connection_line
- {
- char *alias; /* server name */
- CPROTOCOL connection_type;
- unsigned short port;
- char *service_name;
- char *hostname;
- char *options;
- } connection_line_t;
- typedef struct onconfig_line
- {
- char *label;
- char *value;
- char *comment;
- } onconfig_line_t;
- typedef struct onconfig_params
- {
- muintptr shmbase;
- size_t rootsize;
- size_t bufferpool;
- size_t shmvirtsize;
- } onconfig_params_t;
- typedef struct environment
- {
- int type;
- union
- {
- blank_line_t bl;
- comment_line_t cl;
- environment_line_t dl;
- } lines;
- struct environment *next;
- } environment_t;
- typedef struct connection
- {
- int type;
- union
- {
- blank_line_t bl;
- comment_line_t cl;
- connection_line_t dl;
- } lines;
- struct connection *next;
- } connection_t;
- typedef struct configLines
- {
- int type;
- int lineno;
- union
- {
- blank_line_t bl;
- comment_line_t cl;
- onconfig_line_t dl;
- } lines;
- } configLines_t;
- typedef struct serviceName
- {
- char *name;
- struct serviceName *next;
- } serviceName_t;
- typedef struct service_line
- {
- char *name;
- unsigned short port;
- char *protocol;
- serviceName_t *aliases;
- char *comment;
- } service_line_t;
- typedef struct serviceLine
- {
- int type;
- union
- {
- blank_line_t bl;
- comment_line_t cl;
- service_line_t sl;
- } lines;
- struct serviceLine *next;
- } serviceLine_t;
- typedef struct servicesInfo
- {
- int state;
- int CheatingSockets;
- char *servicesFileName;
- serviceLine_t *firstLine;
- size_t MaxNameLength;
- size_t MaxProtoLength;
- size_t MaxAliasLength;
- } servicesInfo_t;
- /* Dbspace struct - holds dbspace specific information */
- typedef struct db_space
- {
- size_t pagesize;
- char *mirrorpath;
- size_t mirroroffset;
- int mirror_flg; /* enum type: IAD_MIRROR_ON|IAD_MIRROR_OFF */
- size_t f_extsize;
- size_t n_extsize;
- int tmp_dbs_flg; /*enum type: IAD_TEMPSPACE_ON|IAD_TEMPSPACE_OFF*/
- } db_space_t;
- /* Sbspace struct - holds sbspace specific information */
- typedef struct sb_sbspace
- {
- char *mirrorpath;
- size_t mirroroffset;
- int mirror_flg; /* enum type: IAD_MIRROR_ON|IAD_MIRROR_OFF */
- size_t metadataoffset;
- size_t metadatasize;
- int tmp_sbs_flg; /*enum type: IAD_TEMPSPACE_ON|IAD_TEMPSPACE_OFF*/
- char *def_specs;
- } sb_space_t;
- /* Blob space struct - holds blob space specific information */
- typedef struct blob_space
- {
- int pageunit;
- char *mirrorpath;
- size_t mirroroffset;
- int mirror_flg; /* enum type: IAD_MIRROR_ON|IAD_MIRROR_OFF */
- } blob_space_t;
- /* Data space struct - holds information for all data spaces */
- struct iad_space
- {
- int type; /* enum type: IAD_DBSPACE|IAD_SBSPACE|IAD_BLOBSPACE */
- enum space_deploy_status dep_stat;
- union
- {
- db_space_t dbs;
- sb_space_t sbs;
- /* ext_space_t exts; TODO - not supported by admin API */
- blob_space_t blobsp;
- } data_spaces;
- char *name;
- char *path;
- size_t size;
- size_t offset;
- struct iad_space *mirror;
- struct iad_space *next;
- };
- /* Struct for transaction logging information */
- typedef struct iad_trans_log
- {
- int type; /* enum type: IAD_PHYSLOG | IAD_LOGICALLOG */
- int logcount;
- size_t logsize;
- char *spc_name;
- } iad_translog_t;
- /* Disk information */
- typedef struct iad_disk
- {
- unsigned long filesys_id;
- unsigned long total_space;
- size_t free_space;
- size_t req_space;
- enum IAD_BOOLEAN is_raw;
- char *long_path;
- char *path; /* First valid subpath of long_path */
- int offset;
- double io_speed;
- int read_speed;
- int write_speed;
- enum IAD_BOOLEAN speed_tested;
- struct iad_disk *next;
- } iad_disk_t;
- typedef struct _iad_machine
- {
- int num_cpus;
- size_t pagesize;
- int blk_size;
- double proc_speed;
- off_t physmemory;
- } iad_machine_t;
- typedef struct _iad_autocfg_params
- {
- int magic_number;
- int params_state;
- int concurrent_users;
- int ds_users;
- int rto_restart_policy;
- int txn_support;
- int mirror_critical;
- int mirror_allspaces;
- int sbspace_enabled;
- int sbspace_logopt;
- size_t max_disk_requested;
- off_t max_memory_requested;
- char *instance_path;
- char *mirror_path;
- int max_cpu_requested;
- int server_type;
- int server_num;
- double lru_min;
- double lru_max;
- enum iad_method cpu_alloc_method;
- enum iad_method mem_alloc_method;
- enum iad_method disk_alloc_method;
- int max_cpu_pct;
- int max_mem_pct;
- int max_disk_pct;
- int error_states[IAD_MAX_AUTOCFG_NUM];
- } iad_autocfg_params_t;
- typedef struct _iad_autocfg_disk
- {
- int space_type;
- size_t recommended_size;
- int recommended_number;
- int num_elements;
- size_t element_size;
- char *path;
- } iad_autocfg_disk_t;
-
- typedef struct _iad_autocfg_results
- {
- int magic_number;
- int results_state;
- off_t user_memory;
- off_t ds_memory; /* dss memory to be configured */
- int ds_max_scans;
- off_t ds_nonpdq_mem;
- off_t shmvirtsize;
- off_t shmadd; /* size of additional shared mem segment */
- off_t vp_memory_cache; /* per processor memory cache */
- off_t onlidx_maxmem;
- int buffers; /* size of buffer cache */
- int cleaners;
- int lrus;
- int locks;
- int num_listen_threads;
- int disk_speed;
- int plog_speed;
- int llog_speed;
- int num_disks;
- iad_autocfg_disk_t disk_alloc[6];
- } iad_autocfg_results_t;
-
- typedef struct instance
- {
- int instance_state;
- char *name;
- environment_t *environment_list;
- connection_t *connection_list;
- configLines_t *onconfig;
- size_t onconfig_size;
- size_t onconfig_cnt;
- int onconfig_key;
- char jsonListPasswd[12];
- iad_space_t *data_space;
- iad_translog_t t_log[2]; /* only 2 log types: physical/logical */
- iad_autocfg_params_t *auto_params;
- iad_autocfg_results_t *auto_results;
- sqlhost_locations_type sqlhost;
- #ifdef WIN32
- WCHAR sqlhost_location[DNLEN+1];
- char *SoftwareKey;
- #endif
- struct instance *next;
- } instance_t;
- typedef struct group_info
- {
- int properties;
- int type;
- char * grpname;
- char * username;
- char * passwd;
- struct group_info * next;
- } group_info_t;
- struct user_info
- {
- unsigned int userproperties;
- group_info_t * additional_groups;
- #ifdef WIN32
- WCHAR DeploymentUser[UNLEN + 1];
- WCHAR DeploymentUserDomain[DNLEN + 1];
- char *DeploymentUserDomainC;
- SID DeploymentUserSID;
- WCHAR LocalHostName[MAX_COMPUTERNAME_LENGTH + 1];
- LSA_HANDLE LocalPolicyHandle;
- /*
- * DomainControler is also used in NetGetDCName() that uses the format
- * \\<MACHINE_NAME>, therefore we need additional 2 chars for "\\"
- */
- WCHAR DomainControler[MAX_COMPUTERNAME_LENGTH + 2 + 1];
- char *DomainControlerC;
- WCHAR AdminGroup[UNLEN + 1];
- WCHAR * passwd;
- char username[UNLEN + DNLEN + 2];
- #endif /* WIN32 */
- };
- /*Used to extract version info from version string*/
- typedef struct verInfo{
- enum IAD_BOOLEAN isVerBeta;
- enum IAD_BOOLEAN isVerSpBld;
- enum IAD_BOOLEAN isVerPID;
- enum IAD_BOOLEAN isOutOfMem;
- int maj;
- int min;
- int fp;
- int interim;
-
- char * verDelimited;
- } verInfo;
- /* structure to store product information */
- typedef struct ifxproduct
- {
- char *fullprodname;
- char *version;
- verInfo prodverInfo;
- PRODUCT_ID product_type;
- }ifxproduct_t;
- #ifdef DISCOVERY_ENABLED
- typedef struct serverdiscovery
- {
- size_t instances_cnt; /* count of instances found */
- size_t alias_list_size; /* size of alias list */
- size_t alias_list_cnt; /* number of aliases found */
- serverAttr *instances_arr; /* from server discovery */
- char *alias_list_arr;
- char **servername_list; /* list of servernames corresponding to instances_arr offset */
- }serverdiscovery_t;
- #endif
- /*
- * This should go to iad_install.h
- */
- typedef struct sub_installer
- {
- int si_prodid;
- char si_nname[6]; /* Short name of sub-installer */
- int si_rc; /* Return Code of Sub-Installer */
- struct sub_installer
- *si_next; /* Next sub-installer in the list or NULL */
- } subi_t;
- /* End of iad_install.h */
- struct install
- {
- long magic_number;
- int mode; /* Change with iadChangeInstallMode() */
- int iad_type; /* Change with iadSetInstallType() */
- int api_pid;
- subi_t *subi_list; /* List of sub-installers running */
- long error;
- long prev_error;
- char dirname[255];
- int install_tag;
- int diskmem_iounits;
- ifxproduct_t *prod;
- status_t * status;
- int build_sqlhost;
- struct user_info user_req;
- iad_machine_t machineconfig;
- iad_disk_t *fs_disk;
- instance_t *head_instance;
- instance_t *curr_instance;
- servicesInfo_t services;
- #ifndef WIN32
- mode_t config_perm;
- mode_t chunk_perm;
- mode_t directory_perm;
- #endif /* WIN32 */
- #ifdef DISCOVERY_ENABLED
- serverdiscovery_t *instances_discovered;
- #endif
- };
- enum server_type
- {
- IAD_SERVER_OLTP = 0,
- IAD_SERVER_DSS,
- IAD_SERVER_MIXED
- };
- enum autocfg_type
- {
- IAD_SET_MAXCPU = 0,
- IAD_SET_MAXMEM,
- IAD_SET_MAXDISK,
- IAD_SET_MAXCPU_PCT,
- IAD_SET_MAXMEM_PCT,
- IAD_SET_MAXDISK_PCT,
- IAD_SET_MIRROR_ALL,
- IAD_SET_MIRROR_CRITICAL,
- IAD_SET_SBSPACE_ENABLED,
- IAD_SET_SBSPACE_LOGOPT,
- IAD_SET_RTOPOLICY,
- IAD_SET_INSTANCEPATH,
- IAD_SET_MIRRORPATH,
- IAD_SET_MAXUSERS,
- IAD_SET_MAXDSUSERS,
- IAD_SET_SERVERTYPE,
- IAD_SET_SERVERNUM,
- IAD_SET_TXNSUPPORT,
- IAD_SET_ROOTPATH,
- IAD_SET_LLOGPATH,
- IAD_SET_PLOGPATH,
- IAD_SET_DATAPATH,
- IAD_SET_SLOBPATH,
- IAD_SET_TEMPPATH,
- IAD_SET_FINALELEMENT = 49
- };
- enum disk_alloc_types
- {
- IAD_ROOTDBS = 0,
- IAD_PLOGDBS,
- IAD_LLOGDBS,
- IAD_DATADBS,
- IAD_SLOBDBS,
- IAD_TEMPDBS
- };
- enum _iad_rec_types
- {
- IAD_AUTO_BUFFERSIZE = 0,
- IAD_AUTO_SHMVIRTSIZE = 1,
- IAD_AUTO_SHMADD = 2,
- IAD_AUTO_VPMEMCACHE = 3,
- IAD_AUTO_TOTALMEMORY = 4,
- IAD_AUTO_CLEANERS = 5,
- IAD_AUTO_LOCKS = 6,
- IAD_AUTO_LISTENTHREADS = 7,
- IAD_AUTO_LRUS = 8,
- IAD_AUTO_TOTAL_DISK_SIZE = 19,
- IAD_AUTO_ROOTDBS_SIZE = 20,
- IAD_AUTO_PLOGDBS_SIZE = 21,
- IAD_AUTO_PLOG_SIZE = 22,
- IAD_AUTO_LLOGDBS_SIZE = 23,
- IAD_AUTO_LLOGS_NUM = 24,
- IAD_AUTO_LLOGS_SIZE = 25,
- IAD_AUTO_DATADBS_SIZE = 26,
- IAD_AUTO_DATADBS_NUM = 27,
- IAD_AUTO_SBSPACE_SIZE = 28,
- IAD_AUTO_SBSPACE_NUM = 29,
- IAD_AUTO_TEMPDBS_SIZE = 30,
- IAD_AUTO_TEMPDBS_NUM = 31,
- IAD_AUTO_NUMCPUS = 32,
- IAD_AUTO_ROOTDBS_PATH = 50,
- IAD_AUTO_LLOGDBS_PATH = 51,
- IAD_AUTO_PLOGDBS_PATH = 52,
- IAD_AUTO_DATADBS_PATH = 53,
- IAD_AUTO_SLOBDBS_PATH = 54,
- IAD_AUTO_TEMPDBS_PATH = 55
- };
- EXPORT int STDCALL finish(install_t *is);
- /* Given the absolute path, populate disk struct with file
- system information */
- EXPORT int STDCALL iadSetFileSysInfo(install_t *install_struct, const char *path, size_t size);
- EXPORT int STDCALL iadGetFileSysInfo(install_t *install_struct, const char *path);
- EXPORT size_t STDCALL iadGetFileSysFreespace(install_t *install_struct, const char *path);
- EXPORT size_t STDCALL iadGetFileSysRequiredspace(install_t *install_struct, const char *path);
- EXPORT int STDCALL iadSetDiskMemUnits(install_t *install_struct, const char *units_str);
- /* Convert size in string format to size_t */
- extern size_t STDCALL iadSizeStrToSize_t(install_t* install_struct, const char *size);
- extern void initMachInfo(install_t *install_struct);
- /* server discovery code */
- extern void initDiscovery(install_t *install_struct);
- extern char ** parseCfgAliases(install_t *install_struct, const char *servername, char *aliases, int *alias_cnt);
- /* Copy source string to destination string */
- extern int STDCALL iadStrDup(char **dest, const char *source);
- /* Check that the provided path is valid */
- extern int STDCALL validatePath(const char *path);
- /* Given a path of a proposed instance to be created, check it for
- possible informix chunk files
- Input: the path to be checked
- Returns:
- - IAD_E_PATH_NOT_EXISTS if not path found (expected for new install)
- - IAD_E_PATHERROR if some other problem is detected, like the path is found
- but its a file or other entity instead of a directory
- - The number of possible chunk files found (0 meaning ok)
- - Positive non-zero number indicates that the path may contain chunk
- files and shouldn't be used
- */
- extern int STDCALL iadCheckInstancePath(install_t *is, const char *instance_path);
- /* Given an absolute path get the directory string */
- extern int STDCALL iadDirFromPath(install_t *is, const char *path, char **dirPath);
- /* Given a path, stripping the path from the end,
- get the first valid parent.
- Returns:
- - the first occurrence of valid subpath found.
- - path if path represents an existing directory
- - NULL if path does not contain valid subpath,
- */
- extern char * STDCALL iadGetValidSubPath(install_t *is, const char *path);
- /* Given an absolute file path, create the file.
- directories in path if not present
- Returns:
- - IAD_E_NOERROR: file was successfully created
- - IAD_E_INVALID_PARAMETER: filename is NULL
- - IAD_E_FILE_OPEN_ERROR: file could not be created
- - IAD_E_PATH_ERROR: file path could not be created
- */
- extern void STDCALL iadXlateFilePathInplace(install_t *install_struct, char *filepath, size_t maxpath);
- extern int STDCALL iadCreateFile(install_t *install_struct, const char *filename);
- extern int STDCALL iadGetEnvironmentVariable(const char *lpName, char *lpBuffer, int size);
- #ifndef WIN32
- /* Set the properties of a given path. Path can be passed as a file,
- a directory or absolute path to the file or directory
- mode - set to disable the ownership of files.
- owner - owner property for the path. This can be NULL. If this is
- NULL, owner property will not be changed for path
- group - group property for the path. This can be NULL. If this is
- NULL, group property will not be changed for path
- Returns:
- - IAD_E_NOERROR: ownership and/or permission was successfully set
- - IAD_E_INVALID_PARAMETER: path is NULL
- - IAD_E_INVALID_PATH: path does not exist or is invalid
- - IAD_E_GROUPINFO_NOT_FOUND: group passed does not exist
- - IAD_E_USERINFO_NOT_FOUND: user passed does not exist
- - IAD_E_FAIL: unable to set ownership and/or permissions
- */
- extern int STDCALL iadSetFileProperties(int mode, const char *path, const char *owner, const char *group, mode_t perms);
- #endif
- /* Given a pathname, this function returns the filename or the parent
- path depending on RETURN_FILENAME mode or RETURN_PATHNAME mode
- Returns:
- - filename string or path string depending on mode passed
- - throws an assertion if invalid mode or null filename is passed
- */
- extern char * STDCALL iadGetNameFromPath(install_t *is, const char *filename, int mode);
- /* Get the version of an informix installation
- Inputs:
- Install_t (struct), Path (informixdir), crfile (name of cr file IIF-cr, IDS2000-cr, etc)
- Returns:
- - version string
- - NULL if version can not be extracted
-
- */
- extern char * STDCALL iadGetVersionFromCRFile(install_t *install_struct, const char *path, const char *crfile);
- /* Check to see if product can be upgraded
- *
- * Inputs:
- * Install_t (struct), currVer (Current version of product being installed), informixdir
- * Returns (int):
- * IAD_I_NO_INSTALLATION : indicates there is not installation present
- * IAD_I_UPGRADEABLE : indicates that product can be upgraded
- * IAD_E_INVALID_UPGRADE : indicates that product can not be upgraded
- *
- */
- extern int STDCALL iadIsSqlhostFileReq(install_t *install_struct);
- extern int STDCALL iadIsServerUpgradeable(install_t *install_struct, const char* currVer, const char *informixdir);
- extern int STDCALL iadIsCSDKUpgradeable(install_t *install_struct, const char* currVer, const char *informixdir);
- extern int STDCALL iadIsConnUpgradeable(install_t *install_struct, const char* currVer, const char *informixdir);
- /* Get all instances related to an installation
- Returns:
- - list of instances
- - server count
- - NULL in the event of an error
- */
- extern char ** STDCALL iadGetInstallationInstances(install_t *is, const char *path, int *server_count);
- #ifdef WIN32
- /* Acquire all subkeys for a given registry key. When the function
- returns, list rs will be populated with subkeys information
- Inputs:
- - rootKey: Parent key to registry specified by keyPath. It can also
- be one of HKEY_CLASSES_ROOT, HKEY_CURRENT_CONFIG,
- HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE,
- HKEY_PERFORMANCE_DATA, HKEY_USERS
- - keyPath: Registry path specifying the location of the key for
- which information is to be acquired.
- - rs: Linked list containing subkeys for rs.
- - node: anything else, 32, 64: default, 32 node or 64 node
- Returns:
- - IAD_E_NOERROR: No Error. Successful completion
- - IAD_E_REGISTRY_ERROR: Error in registry query or registry
- values enumeration.
- - IAD_E_MEMORY_ALLOCATION_FAILURE: Memory allocation failure.
- */
- EXPORT int STDCALL iadQueryRegSubKeys(HKEY rootKey, LPCSTR keyPath, IAD_REGSUBKEYS **rs, iad_registery_view node);
- EXPORT void STDCALL iadFreeRegSubKeys(IAD_REGSUBKEYS **rs);
- /* Acquire information of Name/Type/Data associated with a registry
- key. When the function returns, list rd will be populated with
- information on keyPath
- Inputs:
- - rootKey: Parent key to registry specified by keyPath. It can also
- be one of HKEY_CLASSES_ROOT, HKEY_CURRENT_CONFIG,
- HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE,
- HKEY_PERFORMANCE_DATA, HKEY_USERS
- - keyPath: Registry path specifying the location of the key for
- which information is to be acquired.
- - rs: Linked list containing Name/Type/Data information about rd.
- - node: anything else, 32, 64: default, 32 node or 64 node
- Returns:
- - IAD_E_NOERROR: No Error. Successful completion
- - IAD_E_REGISTRY_ERROR: Error in registry query or registry
- values enumeration.
- - IAD_E_MEMORY_ALLOCATION_FAILURE: Memory allocation failure.
- */
- EXPORT int STDCALL iadQueryRegData(HKEY rootKey, LPCTSTR keyPath, IAD_REGDATA **rd, iad_registery_view node);
- EXPORT void STDCALL iadFreeRegData(IAD_REGDATA **rd);
- /* Given a registry key and an associated regsitry Value, this
- function retieves the Data for the Value
- Inputs:
- - rootHive: Enum type that represents the registry root hive.
- See definition for IAD_HKEY enum type
- - keyPath: Registry path specifying location of key for which info
- is to be acquired
- - regName: Registry Value for which Data is to be acquired
- - node: anything else, 32, 64: default, 32 node or 64 node
- Returns;
- - the data associated with the name is returned upon success
- - NULL is returned if data could not be retrieved
- */
- extern char * STDCALL iadGetRegDataFromName(IAD_HKEY rootHive, const char *keyPath, const char *regName, iad_registery_view node);
- /* Copy a source registry key to a target registry key
- Inputs:
- - source_key: key to be copied
- - dest_key: key to be copied to
- Returns:
- - IAD_E_NOERROR: No Error. Registry key was successfully copied
- */
- extern int STDCALL CopyRegTree(HKEY dest_key, HKEY source_key);
- /* Based on user and server information in the install structure,
- this function creates the informix service with the necessary
- properties on the system. The necessary functions that populate
- install structure with information needed to create the service
- must be called prior to calling this function.
- Call heirarchy:
- - iadAddUserGroupRequired(): Set up structure for user. User
- information will be used for service creation.
- - iadSetEnvironment(): Set INFORMIXDIR
- - iadSetEnvironment(): Set INFORMIXSERVER
- Inputs:
- - is: install structure. Structure will have been prepopulated
- with properties that the service will be created with.
- Returns:
- - IAD_E_STRUCTURE_NOT_INITIALIZED: install structure has not been
- initialized. Therefore memory has not been allocated for it.
- - IAD_E_NULLPOINTER : The instance structure with the service will be
- created has not been defined. Instance structure is null
- : Service name (INFORMIXSERVER) has not been defined
- : INFORMIXDIR has not been defined
- : User account/password with which to create
- service has not been defined in the install
- structure
- - IAD_E_INCORRECT_PASSWORD: User password is incorrect
- - IAD_E_INVALID_PARAMETER: Service already exists
- - IAD_E_FAIL: All other errors. See log
- */
- EXPORT int STDCALL iadDeployWindowsService(install_t *is);
- /*
- removes a service from windows' list of background services name:
- internal name of the service (on_informix)
- Inputs:
- - is: Install structure
- - name: Windows service name
- Returns:
- - IAD_E_NULLPOINTER if name is NULL
- - IAD_E_FAIL if an error occurs in the windows API;
- the return of GetLastError is printed to stdout
- - IAD_E_INVALID_PARAMETER if no service exists with the specified name
- */
- EXPORT int STDCALL iadWinServiceDelete(install_t *is, const char *name);
- #endif
- EXPORT int STDCALL iadSetInstallType(install_t*, int);
- EXPORT int STDCALL deployInstallation(install_t *install_struct);
- EXPORT int STDCALL iadSetInstallModeNoSQL(install_t *is);
- EXPORT int STDCALL iadUnSetInstallModeNoSQL(install_t *is);
- EXPORT int STDCALL iadSetInstallModePrivate(install_t *is);
- EXPORT install_t *STDCALL init_API(int mode, PRODUCT_ID prod, const char *fullProdName, const char *fullVersion);
- EXPORT install_t *STDCALL initInstallAPI(int mode, PRODUCT_ID prod, const char *fullProdName, const char *fullVersion, const char *log_file, const char *dbg_file, int dbg_sev);
- EXPORT int STDCALL setupIATrace(const char *log_file, const char *dbg_file, int dbg_sev);
- EXPORT int STDCALL iadGetErrorCode();
- EXPORT char* STDCALL iadGetErrorText();
- EXPORT int STDCALL iadSetInstallDir(install_t* install_struct, const char *pathname);
- extern int iadGetTrueFalseProperty(const char *value);
- extern int initAutoCfg(instance_t *inst);
- extern void
- iadSetError(
- int rc,
- char *file_name,
- int line_number,
- char *format,
- ...
- );
- extern void
- iadSetOSError(
- int rc,
- char *file_name,
- int line_number,
- int os_error,
- char *format,
- ...
- );
- extern int iadGetOSErrorNumber();
- EXPORT long STDCALL iadGetRecommendation(install_t *inst, int type);
- EXPORT char* STDCALL iadGetRecommendationString(install_t *inst, int type);
- EXPORT int STDCALL iadCalculateRecommendation(install_t *inst);
- EXPORT int STDCALL iadCheckforInstance(install_t *inst, const char *servername, int servernum);
- EXPORT int STDCALL iadCreateServerNum(install_t *inst);
- EXPORT int STDCALL iadCheckAliasList(install_t *inst, const char *alias);
- EXPORT int STDCALL iadLoadRecommendation(install_t *inst);
- EXPORT int STDCALL iadUpdateRecommendation(install_t *inst, int type, const char *value);
- EXPORT int STDCALL iadLoadDefaultConfig(install_t *inst);
- EXPORT int STDCALL iadSetAutoConfig(install_t *inst, int type, const char *value);
- /*
- *iadCompareVers function
- *input: char * ver1, char * ver2 (example: 11.70.FC1W1)
- *return: int
- *return code explanation
- *0:Verstion Strings are equal
- *1:String 1 greater than String 2
- *2:String 2 greater than String 1
- *-2:Invalid String
- *-3:System out of memory
- *-4:Special builds, which can't be compared
- *Note: Beta < Release build < Special build < PID < (PID + speical build)
- *Example: 11.70.FC1B1 < 11.70.FC1 < 11.70.FC1X1 < 11.70.FC1W1 < 11.70.FC1W1X1
- */
- EXPORT int STDCALL iadCompareVers(const char* version1, const char *version2);
- EXPORT int STDCALL iadDeployWindowsService(install_t *is);
- EXPORT int STDCALL iadWinServiceDelete(install_t *is, const char *name);
- /*
- *extractVersInfo function
- *input: char * ver1 (example: 11.70.FC1W1)
- *return: verInfo (Struct) that contains version specific information
- *such as major version, minor version, FixPack Version.
- *Also, verifies if version is Beta, PID and/or Special build.
- */
- EXPORT verInfo STDCALL iadExtractVersInfo(const char* version1);
- extern char* iad_strupshift(const char *value);
- int test_write_speed(install_t *is, iad_disk_t *dp, int fd, off_t measure_size, int measure);
- int test_read_speed(install_t *is, iad_disk_t *dp, int fd, off_t measure_size, int measure);
- #if defined(NT)
- extern LPCSTR WideToString(LPWSTR wideStr);
- #endif
- #endif /* API_API_INCLUDED */
|