[Apcupsd-commits] apcupsd/include apc_extern.h,1.15,1.16 apc_i18n.h,1.2,1.3 apc_nis.h,1.2,1.3 apc_st
Brought to you by:
adk0212
From: Adam K. <ad...@us...> - 2005-05-31 00:51:57
|
Update of /cvsroot/apcupsd/apcupsd/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26830 Modified Files: apc_extern.h apc_i18n.h apc_nis.h apc_struct.h apc_version.h Log Message: Code style normalization. Index: apc_struct.h =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/include/apc_struct.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- apc_struct.h 18 May 2005 18:32:08 -0000 1.16 +++ apc_struct.h 31 May 2005 00:51:46 -0000 1.17 @@ -1,122 +1,111 @@ /* - * struct.h -- header file for apcupsd package - * - * apcupsd.c -- Simple Daemon to catch power failure signals from a - * BackUPS, BackUPS Pro, or SmartUPS (from APCC). - * -- Now SmartMode support for SmartUPS and BackUPS Pro. - * - * Copyright (C) 1996-99 Andre M. Hedrick <an...@su...> - * All rights reserved. + * apc_struct.h * + * Common apcupsd structures. */ /* - Copyright (C) 2000-2004 Kern Sibbald - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - + * Copyright (C) 2000-2004 Kern Sibbald + * Copyright (C) 1996-1999 Andre M. Hedrick <an...@su...> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General + * Public License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. */ -/*********************************************************************/ - #ifndef _APC_STRUCT_H #define _APC_STRUCT_H typedef enum { - NO_CABLE=0, /* Default Disable */ - CUSTOM_SIMPLE, /* SIMPLE cable simple */ - APC_940_0119A, /* APC cable number 940-0119A */ - APC_940_0127A, /* APC cable number 940-0127A */ - APC_940_0128A, /* APC cable number 940-0128A */ - APC_940_0020B, /* APC cable number 940-0020B */ - APC_940_0020C, /* APC cable number 940-0020C identical to 20B */ - APC_940_0023A, /* APC cable number 940-0023A */ - MAM_CABLE, /* MAM cable for Alfatronic SPS500X */ - CUSTOM_SMART, /* SMART cable smart */ - APC_940_0024B, /* APC cable number 940-0024B */ - APC_940_0024C, /* APC cable number 940-0024C */ - APC_940_1524C, /* APC cable number 940-1524C */ - APC_940_0024G, /* APC cable number 940-0024G */ - APC_940_0095A, /* APC cable number 940-0095A */ - APC_940_0095B, /* APC cable number 940-0095B */ - APC_940_0095C, /* APC cable number 940-0095C */ - APC_NET, /* Ethernet Link */ - USB_CABLE, /* USB cable */ - APC_940_00XXX /* APC cable number UNKNOWN */ + NO_CABLE = 0, /* Default Disable */ + CUSTOM_SIMPLE, /* SIMPLE cable simple */ + APC_940_0119A, /* APC cable number 940-0119A */ + APC_940_0127A, /* APC cable number 940-0127A */ + APC_940_0128A, /* APC cable number 940-0128A */ + APC_940_0020B, /* APC cable number 940-0020B */ + APC_940_0020C, /* APC cable number 940-0020C identical to 20B */ + APC_940_0023A, /* APC cable number 940-0023A */ + MAM_CABLE, /* MAM cable for Alfatronic SPS500X */ + CUSTOM_SMART, /* SMART cable smart */ + APC_940_0024B, /* APC cable number 940-0024B */ + APC_940_0024C, /* APC cable number 940-0024C */ + APC_940_1524C, /* APC cable number 940-1524C */ + APC_940_0024G, /* APC cable number 940-0024G */ + APC_940_0095A, /* APC cable number 940-0095A */ + APC_940_0095B, /* APC cable number 940-0095B */ + APC_940_0095C, /* APC cable number 940-0095C */ + APC_NET, /* Ethernet Link */ + USB_CABLE, /* USB cable */ + APC_940_00XXX /* APC cable number UNKNOWN */ } UpsCable; /* The order of these UpsModes is important!! */ typedef enum { - NO_UPS=0, /* Default Disable */ - DUMB_UPS, /* Dumb UPS driver */ - BK, /* Simple Signal */ - SHAREBASIC, /* Simple Signal, Share */ - NETUPS, /* */ - BKPRO, /* SubSet Smart Signal */ - VS, /* SubSet Smart Signal */ - NBKPRO, /* Smarter BKPRO Signal */ - SMART, /* Smart Signal */ - MATRIX, /* Smart Signal */ - SHARESMART, /* Smart Signal, Share */ - APCSMART_UPS, /* APC Smart UPS (any)*/ - USB_UPS, /* USB UPS driver */ - SNMP_UPS, /* SNMP UPS driver */ - NETWORK_UPS,/* NETWORK UPS driver */ - TEST_UPS /* TEST UPS Driver */ + NO_UPS = 0, /* Default Disable */ + DUMB_UPS, /* Dumb UPS driver */ + BK, /* Simple Signal */ + SHAREBASIC, /* Simple Signal, Share */ + NETUPS, /* */ + BKPRO, /* SubSet Smart Signal */ + VS, /* SubSet Smart Signal */ + NBKPRO, /* Smarter BKPRO Signal */ + SMART, /* Smart Signal */ + MATRIX, /* Smart Signal */ + SHARESMART, /* Smart Signal, Share */ + APCSMART_UPS, /* APC Smart UPS (any) */ + USB_UPS, /* USB UPS driver */ + SNMP_UPS, /* SNMP UPS driver */ + NETWORK_UPS, /* NETWORK UPS driver */ + TEST_UPS /* TEST UPS Driver */ } UpsMode; typedef enum { - NO_CLASS=0, - STANDALONE, /**/ - SHARESLAVE, /**/ - NETSLAVE, /**/ - SHAREMASTER, /**/ - NETMASTER, /**/ - SHARENETMASTER /**/ + NO_CLASS = 0, + STANDALONE, + SHARESLAVE, + NETSLAVE, + SHAREMASTER, + NETMASTER, + SHARENETMASTER } ClassMode; typedef enum { - NO_SHARE_NET=0, - DISABLE, /* Disable Share or Net UPS */ - SHARE, /* ShareUPS Internal */ - NET, /* NetUPS */ - SHARENET /* Share and Net, Master */ + NO_SHARE_NET = 0, + DISABLE, /* Disable Share or Net UPS */ + SHARE, /* ShareUPS Internal */ + NET, /* NetUPS */ + SHARENET /* Share and Net, Master */ } ShareNetMode; typedef enum { - NO_LOGON=0, - NEVER, /* Disable Setting NoLogon */ - TIMEOUT, /* Based on TIMEOUT + 10 percent */ - PERCENT, /* Based on PERCENT + 10 percent */ - MINUTES, /* Based on MINUTES + 10 percent */ - ALWAYS /* Stop All New Login Attempts. but ROOT */ + NO_LOGON = 0, + NEVER, /* Disable Setting NoLogon */ + TIMEOUT, /* Based on TIMEOUT + 10 percent */ + PERCENT, /* Based on PERCENT + 10 percent */ + MINUTES, /* Based on MINUTES + 10 percent */ + ALWAYS /* Stop All New Login Attempts. but ROOT */ } NoLoginMode; -/* - * List all the internal self tests allowed. - */ +/* List all the internal self tests allowed. */ typedef enum { - SMART_TEST_LEDS = 0, - SMART_TEST_SELFTEST, - SMART_TEST_POWERFAIL, - SMART_TEST_CALIBRATION, - SMART_CHANGE_NAME, - SMART_CHANGE_BATTDATE, - SMART_CHANGE_EPROM, - SMART_TEST_MAX + SMART_TEST_LEDS = 0, + SMART_TEST_SELFTEST, + SMART_TEST_POWERFAIL, + SMART_TEST_CALIBRATION, + SMART_CHANGE_NAME, + SMART_CHANGE_BATTDATE, + SMART_CHANGE_EPROM, + SMART_TEST_MAX } SelfTests; /* @@ -136,40 +125,40 @@ * selftest. */ typedef struct SELFTEST { - int activate; - int status; + int activate; + int status; } SELFTEST; typedef struct geninfo { - const char *name; /* JHNC: name mustn't contain whitespace */ - const char *long_name; - int type; -} GENINFO; /* for static declaration of data */ + const char *name; /* JHNC: name mustn't contain whitespace */ + const char *long_name; + int type; +} GENINFO; /* for static declaration of data */ typedef struct internalgeninfo { - char name[MAXSTRING]; /* JHNC: name mustn't contain whitespace */ - char long_name[MAXSTRING]; - int type; -} INTERNALGENINFO; /* for assigning into upsinfo */ + char name[MAXSTRING]; /* JHNC: name mustn't contain whitespace */ + char long_name[MAXSTRING]; + int type; +} INTERNALGENINFO; /* for assigning into upsinfo */ /* Structure that contains information on each of our slaves. * Also, for a slave, the first slave packet is info on the * master. */ typedef struct slaveinfo { - int remote_state; /* state of master */ - int disconnecting_slave; /* set if old style slave */ - int ms_errno; /* errno last error */ - int socket; /* current open socket this slave */ - int port; /* port */ - int error; /* set when error message printed */ - int errorcnt; /* count of errors */ - time_t down_time; /* time slave was set RMT_DOWN */ - struct sockaddr_in addr; - char usermagic[APC_MAGIC_SIZE]; /* Old style password */ - char name[MAXTOKENLEN]; /* master/slave domain name (or IP) */ - char password[MAXTOKENLEN]; /* for CRAM-MD5 authentication */ + int remote_state; /* state of master */ + int disconnecting_slave; /* set if old style slave */ + int ms_errno; /* errno last error */ + int socket; /* current open socket this slave */ + int port; /* port */ + int error; /* set when error message printed */ + int errorcnt; /* count of errors */ + time_t down_time; /* time slave was set RMT_DOWN */ + struct sockaddr_in addr; + char usermagic[APC_MAGIC_SIZE]; /* Old style password */ + char name[MAXTOKENLEN]; /* master/slave domain name (or IP) */ + char password[MAXTOKENLEN]; /* for CRAM-MD5 authentication */ } SLAVEINFO; /* @@ -180,32 +169,34 @@ * problems. */ typedef struct netdata { - int32_t OnBatt; - int32_t BattLow; - int32_t BatteryUp; - int32_t BattChg; - int32_t ShutDown; - int32_t nettime; - int32_t TimeLeft; - int32_t ChangeBatt; - int32_t load; - int32_t timedout; - int32_t timelout; - int32_t emergencydown; - int32_t remote_state; - int32_t cap_battlev; - int32_t cap_runtim; - char apcmagic[APC_MAGIC_SIZE]; - char usermagic[APC_MAGIC_SIZE]; + int32_t OnBatt; + int32_t BattLow; + int32_t BatteryUp; + int32_t BattChg; + int32_t ShutDown; + int32_t nettime; + int32_t TimeLeft; + int32_t ChangeBatt; + int32_t load; + int32_t timedout; + int32_t timelout; + int32_t emergencydown; + int32_t remote_state; + int32_t cap_battlev; + int32_t cap_runtim; + char apcmagic[APC_MAGIC_SIZE]; + char usermagic[APC_MAGIC_SIZE]; } NETDATA; -/* the following define MUST be changed each time you +/* + * The following define MUST be changed each time you * change something in the upsinfo structure. Otherwise, you * risk to have users reading the shared memory with an old * nonvalid upsinfo structure. */ #define UPSINFO_VERSION 12 + /* * There is no need to change the following, but you can if * you want, but it must be at least 4 characters to match @@ -214,251 +205,241 @@ #define UPSINFO_ID "UPS!" class UPSINFO { -public: - char id[5]; - int version; - int size; - char release[20]; - - int fd; /* serial port file descriptor */ - - /* UPS capability array and codes */ - char UPS_Cap[CI_MAXCI+1]; /* TRUE if UPS has capability */ - unsigned int UPS_Cmd[CI_MAXCI+1]; /* Command or function code */ + public: + char id[5]; + int version; + int size; + char release[20]; - char *buf; /* scratch buffer */ - int buf_len; /* buffer length */ + int fd; /* serial port file descriptor */ + /* UPS capability array and codes */ + char UPS_Cap[CI_MAXCI + 1]; /* TRUE if UPS has capability */ + unsigned int UPS_Cmd[CI_MAXCI + 1]; /* Command or function code */ - INTERNALGENINFO cable; - INTERNALGENINFO enable_access; - INTERNALGENINFO nologin; - INTERNALGENINFO mode; - INTERNALGENINFO upsclass; - INTERNALGENINFO sharenet; + char *buf; /* scratch buffer */ + int buf_len; /* buffer length */ - int num_execed_children; /* children created in execute_command() */ - /* Internal state flags set in response to UPS condition */ - time_t ShutDown; /* set when doing shutdown */ - time_t SelfTest; /* start time of self test */ - time_t LastSelfTest; /* time of last self test */ - time_t poll_time; /* last time UPS polled -- fillUPS() */ - time_t start_time; /* time apcupsd started */ - time_t last_onbatt_time; /* last time on batteries */ - time_t last_offbatt_time; /* last time off batteries */ - time_t last_time_on_line; - time_t last_time_annoy; - time_t last_time_nologon; - time_t last_time_changeme; - time_t last_master_connect_time; /* last time master connected */ - int num_xfers; /* number of times on batteries */ - int cum_time_on_batt; /* total time on batteries since startup */ - int wait_time; /* suggested wait time for drivers in - * device_check_state() - */ + INTERNALGENINFO cable; + INTERNALGENINFO enable_access; + INTERNALGENINFO nologin; + INTERNALGENINFO mode; + INTERNALGENINFO upsclass; + INTERNALGENINFO sharenet; - /* Items reported by smart UPS */ - /* Volatile items -- i.e. they change with the state of the UPS */ - char linequal[8]; /* Line quality */ - unsigned int reg1; /* register 1 */ - unsigned int reg2; /* register 2 */ - unsigned int reg3; /* register 3 */ - unsigned int dipsw; /* dip switch info */ - unsigned int InputPhase; /* The current AC input phase. */ - unsigned int OutputPhase; /* The current AC output phase. */ - char G[22]; /* reason for last switch to batteries */ - char X[8]; /* results of last seft test */ - double BattChg; /* remaining UPS charge % */ - double LineMin; /* min line voltage seen */ - double LineMax; /* max line voltage seen */ - double UPSLoad; /* battery load percentage */ - double LineFreq; /* line freq. */ - double LineVoltage; /* Line Voltage */ - double OutputVoltage; /* Output Voltage */ - double OutputFreq; /* Output Frequency */ - double OutputCurrent; /* Output Current */ - double UPSTemp; /* UPS internal temperature */ - double BattVoltage; /* Actual Battery voltage -- about 24V */ - double LastSTTime; /* hours since last self test -- not yet implemented */ - int32_t Status; /* UPS status (Bitmapped) */ - double TimeLeft; /* Est. time UPS can run on batt. */ - double humidity; /* Humidity */ - double ambtemp; /* Ambient temperature */ - char eprom[500]; /* Eprom values */ + int num_execed_children; /* children created in execute_command() */ - /* Items reported by smart UPS */ - /* Static items that normally do not change during UPS operation */ - int NomOutputVoltage; /* Nominial voltage when on batteries */ - double nombattv; /* Nominal batt. voltage -- not actual */ - int extbatts; /* number of external batteries attached */ - int badbatts; /* number of bad batteries */ - int lotrans; /* min line voltage before using batt. */ - int hitrans; /* max line voltage before using batt. */ - int rtnpct; /* % batt charge necessary for return */ - int dlowbatt; /* low batt warning in mins. */ - int dwake; /* wakeup delay seconds */ - int dshutd; /* shutdown delay seconds */ - char birth[20]; /* manufacture date */ - char serial[32]; /* serial number */ - char battdat[20]; /* battery installation date */ - char selftest[9]; /* selftest interval as ASCII */ - char firmrev[20]; /* firmware revision */ - char upsname[UPSNAMELEN]; /* UPS internal name */ - char upsmodel[20]; /* ups model number */ - char sensitivity[8]; /* sensitivity to line fluxuations */ - char beepstate[8]; /* when to beep on power failure. */ - char selftestmsg[80]; + /* Internal state flags set in response to UPS condition */ + time_t ShutDown; /* set when doing shutdown */ + time_t SelfTest; /* start time of self test */ + time_t LastSelfTest; /* time of last self test */ + time_t poll_time; /* last time UPS polled -- fillUPS() */ + time_t start_time; /* time apcupsd started */ + time_t last_onbatt_time; /* last time on batteries */ + time_t last_offbatt_time; /* last time off batteries */ + time_t last_time_on_line; + time_t last_time_annoy; + time_t last_time_nologon; + time_t last_time_changeme; + time_t last_master_connect_time; /* last time master connected */ + int num_xfers; /* number of times on batteries */ + int cum_time_on_batt; /* total time on batteries since startup */ + int wait_time; /* suggested wait time for drivers in + * device_check_state() */ - /* Items specified from config file */ - int PoweredByUPS; /* The only bit left out from the bitmap */ - int annoy; - int maxtime; - int annoydelay; /* delay before annoying users with logoff request */ - int onbattdelay; /* delay before reacting to a power failure */ - int killdelay; /* delay after pwrfail before issuing UPS shutdown */ - int nologin_time; - int nologin_file; - int stattime; - int datatime; - int sysfac; - int reports; - int nettime; /* Time interval for master to send to slaves */ - int percent; /* shutdown when batt % less than this */ - int runtime; /* shutdown when runtime less than this */ - char nisip[64]; /* IP for NIS */ - int statusport; /* TCP port for STATUS */ - int netstats; /* turn on/off network status */ - int logstats; /* turn on/off logging of status info */ - char device[MAXSTRING]; /* device name in use */ - char configfile[APC_FILENAME_MAX]; /* config filename */ - char statfile[APC_FILENAME_MAX]; /* status filename */ - char eventfile[APC_FILENAME_MAX]; /* temp events file */ - int eventfilemax; /* max size of eventfile in kilobytes */ - int event_fd; /* fd for eventfile */ + /* Items reported by smart UPS */ + /* Volatile items -- i.e. they change with the state of the UPS */ + char linequal[8]; /* Line quality */ + unsigned int reg1; /* register 1 */ + unsigned int reg2; /* register 2 */ + unsigned int reg3; /* register 3 */ + unsigned int dipsw; /* dip switch info */ + unsigned int InputPhase; /* The current AC input phase. */ + unsigned int OutputPhase; /* The current AC output phase. */ + char G[22]; /* reason for last switch to batteries */ + char X[8]; /* results of last seft test */ + double BattChg; /* remaining UPS charge % */ + double LineMin; /* min line voltage seen */ + double LineMax; /* max line voltage seen */ + double UPSLoad; /* battery load percentage */ + double LineFreq; /* line freq. */ + double LineVoltage; /* Line Voltage */ + double OutputVoltage; /* Output Voltage */ + double OutputFreq; /* Output Frequency */ + double OutputCurrent; /* Output Current */ + double UPSTemp; /* UPS internal temperature */ + double BattVoltage; /* Actual Battery voltage -- about 24V */ + double LastSTTime; /* hours since last self test -- not yet implemented */ + int32_t Status; /* UPS status (Bitmapped) */ + double TimeLeft; /* Est. time UPS can run on batt. */ + double humidity; /* Humidity */ + double ambtemp; /* Ambient temperature */ + char eprom[500]; /* Eprom values */ - int NetUpsPort; /* Our communication port */ - char master_name[APC_FILENAME_MAX]; /**/ + /* Items reported by smart UPS */ + /* Static items that normally do not change during UPS operation */ + int NomOutputVoltage; /* Nominial voltage when on batteries */ + double nombattv; /* Nominal batt. voltage -- not actual */ + int extbatts; /* number of external batteries attached */ + int badbatts; /* number of bad batteries */ + int lotrans; /* min line voltage before using batt. */ + int hitrans; /* max line voltage before using batt. */ + int rtnpct; /* % batt charge necessary for return */ + int dlowbatt; /* low batt warning in mins. */ + int dwake; /* wakeup delay seconds */ + int dshutd; /* shutdown delay seconds */ + char birth[20]; /* manufacture date */ + char serial[32]; /* serial number */ + char battdat[20]; /* battery installation date */ + char selftest[9]; /* selftest interval as ASCII */ + char firmrev[20]; /* firmware revision */ + char upsname[UPSNAMELEN]; /* UPS internal name */ + char upsmodel[20]; /* ups model number */ + char sensitivity[8]; /* sensitivity to line fluxuations */ + char beepstate[8]; /* when to beep on power failure. */ + char selftestmsg[80]; - char lockpath[APC_FILENAME_MAX]; /* BSC, made static -RF */ - int lockfile; /* BSC */ + /* Items specified from config file */ + int PoweredByUPS; /* The only bit left out from the bitmap */ + int annoy; + int maxtime; + int annoydelay; /* delay before annoying users with logoff request */ + int onbattdelay; /* delay before reacting to a power failure */ + int killdelay; /* delay after pwrfail before issuing UPS shutdown */ + int nologin_time; + int nologin_file; + int stattime; + int datatime; + int sysfac; + int reports; + int nettime; /* Time interval for master to send to slaves */ + int percent; /* shutdown when batt % less than this */ + int runtime; /* shutdown when runtime less than this */ + char nisip[64]; /* IP for NIS */ + int statusport; /* TCP port for STATUS */ + int netstats; /* turn on/off network status */ + int logstats; /* turn on/off logging of status info */ + char device[MAXSTRING]; /* device name in use */ + char configfile[APC_FILENAME_MAX]; /* config filename */ + char statfile[APC_FILENAME_MAX]; /* status filename */ + char eventfile[APC_FILENAME_MAX]; /* temp events file */ + int eventfilemax; /* max size of eventfile in kilobytes */ + int event_fd; /* fd for eventfile */ - char usermagic[APC_MAGIC_SIZE]; /* security id string */ - int ChangeBattCounter; /* For UPS_REPLACEBATT, see apcaction.c */ + int NetUpsPort; /* Our communication port */ + char master_name[APC_FILENAME_MAX]; + /**/ char lockpath[APC_FILENAME_MAX]; /* BSC, made static -RF */ + int lockfile; /* BSC */ - int remote_state; /**/ + char usermagic[APC_MAGIC_SIZE]; /* security id string */ + int ChangeBattCounter; /* For UPS_REPLACEBATT, see apcaction.c */ - /* - * Added with multi-UPS. We try to mantain the UPSINFO layout as clean as - * possible to be backward compatible. All moved variables are kept as - * reserved and all the new variables are at the end of the structure. - */ + int remote_state; + /* + * Added with multi-UPS. We try to mantain the UPSINFO layout as clean as + * possible to be backward compatible. All moved variables are kept as + * reserved and all the new variables are at the end of the structure. + */ #ifndef HAVE_PTHREADS - /* - * IPC - */ - /* - * Don't use shmUPS directly: call ipc functions to get it or - * unpredictable results may happen. - */ - int sem_id; /* Semaphore ID */ - int shm_id; /* Shared memory ID */ - struct sembuf semUPS[NUM_SEM_OPER]; /* Semaphore operators */ - int idshmUPS; /* key of shared memory area */ - int idsemUPS; /* key of semphores */ + /* IPC */ + + /* + * Don't use shmUPS directly: call ipc functions to get it or + * unpredictable results may happen. + */ + int sem_id; /* Semaphore ID */ + int shm_id; /* Shared memory ID */ + struct sembuf semUPS[NUM_SEM_OPER]; /* Semaphore operators */ + int idshmUPS; /* key of shared memory area */ + int idsemUPS; /* key of semphores */ #endif - /* - * Linked list of UPSes used in apclist.c - */ + /* Linked list of UPSes used in apclist.c */ - UPSINFO *next; + UPSINFO *next; #ifdef HAVE_PTHREADS - pthread_mutex_t mutex; - int refcnt; /* thread attach count */ + pthread_mutex_t mutex; + int refcnt; /* thread attach count */ #endif - const struct upsdriver *driver; /* UPS driver for this UPSINFO */ - void *driver_internal_data; /* Driver private data */ + const struct upsdriver *driver; /* UPS driver for this UPSINFO */ + void *driver_internal_data; /* Driver private data */ }; /* Used only in apcaccess.c */ typedef struct datainfo { - char apcmagic[APC_MAGIC_SIZE]; - int update_master_config; - int get_master_status; - int slave_status; - int call_master_shutdown; - char accessmagic[ACCESS_MAGIC_SIZE]; + char apcmagic[APC_MAGIC_SIZE]; + int update_master_config; + int get_master_status; + int slave_status; + int call_master_shutdown; + char accessmagic[ACCESS_MAGIC_SIZE]; } DATAINFO; typedef int (HANDLER) (UPSINFO *, int, const GENINFO *, const char *); typedef struct { - const char *key; - HANDLER *handler; - size_t offset; - const GENINFO *values; - const char *help; + const char *key; + HANDLER *handler; + size_t offset; + const GENINFO *values; + const char *help; } PAIRS; typedef struct configinfo { - int new_annoy; - int new_maxtime; - int new_delay; + int new_annoy; + int new_maxtime; + int new_delay; #ifdef __NOLOGIN - int new_nologin; -#endif /* __NOLOGIN */ - int new_stattime; - int new_datatime; - int new_nettime; - int new_percent; + int new_nologin; +#endif /* __NOLOGIN */ + int new_stattime; + int new_datatime; + int new_nettime; + int new_percent; } CONFIGINFO; -/* - * These are needed for commands executed in apcaction.c - */ +/*These are needed for commands executed in apcaction.c */ typedef struct { - char *command; - int pid; + char *command; + int pid; } UPSCOMMANDS; typedef struct s_cmd_msg { - int level; - char *msg; + int level; + char *msg; } UPSCMDMSG; typedef struct netclient_s { - int fd; /* Network FD */ - struct sockaddr_in who; /* Other side's IP address */ - UPSINFO *ups; /* Client's selected UPS */ - int authlevel; /* Level of authorization of the client */ - int net_poll_time; /* Time between two client's polls */ - int last_poll; /* Last client's poll */ - struct netclient_s *next; /* Linked list */ + int fd; /* Network FD */ + struct sockaddr_in who; /* Other side's IP address */ + UPSINFO *ups; /* Client's selected UPS */ + int authlevel; /* Level of authorization of the client */ + int net_poll_time; /* Time between two client's polls */ + int last_poll; /* Last client's poll */ + struct netclient_s *next; /* Linked list */ } NETCLIENT; -/* - * Net commands structure. - */ +/* Net commands structure. */ typedef struct { - char *name; - int (*function) (NETCLIENT * nc, int argc, char *argv[]); - char *syntax; - char *help; - int authlevel; + char *name; + int (*function) (NETCLIENT *nc, int argc, char *argv[]); + char *syntax; + char *help; + int authlevel; } NETCMD; #if defined(_SEM_SEMUN_UNDEFINED) union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ - unsigned short int *array; /* array for GETALL & SETALL */ - struct seminfo *__buf; /* buffer for IPC_INFO */ + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ + unsigned short int *array; /* array for GETALL & SETALL */ + struct seminfo *__buf; /* buffer for IPC_INFO */ }; #endif -#endif /* _APC_STRUCT_H */ +#endif /* _APC_STRUCT_H */ Index: apc_version.h =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/include/apc_version.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- apc_version.h 28 May 2002 13:34:27 -0000 1.1.1.1 +++ apc_version.h 31 May 2005 00:51:46 -0000 1.2 @@ -1,60 +1,26 @@ /* - * apc_version.h -- header file for apcupsd package - * - * Copyright (C) 1999-2000 Riccardo Facchetti <ric...@ma...> - * - * apcupsd.c -- Simple Daemon to catch power failure signals from a - * BackUPS, BackUPS Pro, or SmartUPS (from APCC). - * -- Now SmartMode support for SmartUPS and BackUPS Pro. - * - * Copyright (C) 1996-99 Andre M. Hedrick <an...@su...> - * All rights reserved. - */ - -/* - * GNU GENERAL PUBLIC LICENSE - * Version 2, June 1991 - * - * Copyright (C) 1989, 1991 Free Software Foundation, Inc. - * 675 Mass Ave, Cambridge, MA 02139, USA - * Everyone is permitted to copy and distribute verbatim copies - * of this license document, but changing it is not allowed. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * apc_version.h * + * Current apcupsd version info. */ /* - * IN NO EVENT SHALL ANY AND ALL PERSONS INVOLVED IN THE DEVELOPMENT OF THIS - * PACKAGE, NOW REFERRED TO AS APCUPSD-Team BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING - * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ANY OR ALL - * OF THE APCUPSD-Team HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * Copyright (C) 1999-2000 Riccardo Facchetti <ric...@ma...> + * Copyright (C) 1996-1999 Andre M. Hedrick <an...@su...> * - * THE APCUPSD-Team SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN AS IS BASIS, AND THE APCUPSD-Team HAS NO OBLIGATION TO PROVIDE - * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General + * Public License as published by the Free Software Foundation. * - * THE APCUPSD-Team HAS ABSOLUTELY NO CONNECTION WITH THE COMPANY - * AMERICAN POWER CONVERSION, APCC. THE APCUPSD-Team DID NOT AND - * HAS NOT SIGNED ANY NON-DISCLOSURE AGREEMENTS WITH APCC. ANY AND ALL - * OF THE LOOK-A-LIKE ( UPSlink(tm) Language ) WAS DERIVED FROM THE - * SOURCES LISTED BELOW. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. */ #ifndef _APC_VERSION_H @@ -65,7 +31,7 @@ #define APCUPSD_RELEASE VERSION #ifndef APCUPSD_HOST -#define APCUPSD_HOST HOST +# define APCUPSD_HOST HOST #endif #endif /*_APC_VERSION_H */ Index: apc_i18n.h =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/include/apc_i18n.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- apc_i18n.h 23 Jan 2005 16:52:24 -0000 1.2 +++ apc_i18n.h 31 May 2005 00:51:46 -0000 1.3 @@ -1,65 +1,29 @@ /* - * apc_i18n.h -- header file for apcupsd package (internationalization) - * - * Copyright (C) 1999-2000 Riccardo Facchetti <ric...@ma...> - * - * apcupsd.c -- Simple Daemon to catch power failure signals from a - * BackUPS, BackUPS Pro, or SmartUPS (from APCC). - * -- Now SmartMode support for SmartUPS and BackUPS Pro. - * - * Copyright (C) 1996-99 Andre M. Hedrick <an...@su...> - * All rights reserved. - */ - -/* - * GNU GENERAL PUBLIC LICENSE - * Version 2, June 1991 - * - * Copyright (C) 1989, 1991 Free Software Foundation, Inc. - * 675 Mass Ave, Cambridge, MA 02139, USA - * Everyone is permitted to copy and distribute verbatim copies - * of this license document, but changing it is not allowed. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * apc_i18n.h * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Internationalization header * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Original file: fetchmail-4.7.4/i18n.h * */ /* - * IN NO EVENT SHALL ANY AND ALL PERSONS INVOLVED IN THE DEVELOPMENT OF THIS - * PACKAGE, NOW REFERRED TO AS "APCUPSD-Team" BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING - * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ANY OR ALL - * OF THE "APCUPSD-Team" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE "APCUPSD-Team" SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE "APCUPSD-Team" HAS NO OBLIGATION TO PROVIDE - * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * Copyright (C) 1999-2000 Riccardo Facchetti <ric...@ma...> + * Copyright (C) 1996-99 Andre M. Hedrick <an...@su...> * - * THE "APCUPSD-Team" HAS ABSOLUTELY NO CONNECTION WITH THE COMPANY - * AMERICAN POWER CONVERSION, "APCC". THE "APCUPSD-Team" DID NOT AND - * HAS NOT SIGNED ANY NON-DISCLOSURE AGREEMENTS WITH "APCC". ANY AND ALL - * OF THE LOOK-A-LIKE ( UPSlink(tm) Language ) WAS DERIVED FROM THE - * SOURCES LISTED BELOW. + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General + * Public License as published by the Free Software Foundation. * - */ -/* - * File contributed by Riccardo Facchetti <ric...@ma...> + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. * - * Original file: fetchmail-4.7.4/i18n.h + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. */ #ifdef ENABLE_NLS @@ -84,4 +48,3 @@ # endif #endif - Index: apc_nis.h =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/include/apc_nis.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- apc_nis.h 7 Feb 2004 10:04:06 -0000 1.2 +++ apc_nis.h 31 May 2005 00:51:46 -0000 1.3 @@ -1,20 +1,35 @@ /* - * Include file for apc_nis.c definitions + * apc_nis.h * + * Include file for apc_nis.c definitions */ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General + * Public License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ -extern struct sockaddr_in tcp_serv_addr; /* socket information */ -extern int net_errno; /* error number -- not yet implemented */ -extern char *net_errmsg; /* pointer to error message */ -extern char net_errbuf[256]; /* error message buffer for messages */ - - +extern struct sockaddr_in tcp_serv_addr; /* socket information */ +extern int net_errno; /* error number -- not yet implemented */ +extern char *net_errmsg; /* pointer to error message */ +extern char net_errbuf[256]; /* error message buffer for messages */ /* * Receive a message from the other end. Each message consists of * two packets. The first is a header that contains the size * of the data that follows in the second packet. + * * Returns number of bytes read * Returns 0 on end of file * Returns -1 on error @@ -25,6 +40,7 @@ * Send a message over the network. The send consists of * two network packets. The first is sends a short containing * the length of the data packet which follows. + * * Returns number of bytes sent * Returns -1 on error */ @@ -32,6 +48,7 @@ /* * Open a TCP connection to the UPS network server + * * Returns -1 on error * Returns socket file descriptor otherwise */ @@ -42,4 +59,3 @@ /* Wait for and accept a new TCP connection */ int net_accept(int fd, struct sockaddr_in *cli_addr); - Index: apc_extern.h =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/include/apc_extern.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- apc_extern.h 24 Apr 2005 17:27:48 -0000 1.15 +++ apc_extern.h 31 May 2005 00:51:46 -0000 1.16 @@ -1,55 +1,44 @@ /* - * apc_extern.h -- header file for apcupsd package - * - * apcupsd.c -- Simple Daemon to catch power failure signals from a - * BackUPS, BackUPS Pro, or SmartUPS (from APCC). - * -- Now SmartMode support for SmartUPS and BackUPS Pro. - * - * All rights reserved. + * apc_extern.h * + * Public exports. */ /* - Copyright (C) 2000-2004 Kern Sibbald - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - + * Copyright (C) 2000-2004 Kern Sibbald + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General + * Public License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. */ #ifndef _APC_EXTERN_H #define _APC_EXTERN_H -/*********************************************************************/ -/* Function ProtoTypes */ -/*********************************************************************/ +/* Function Prototypes */ extern UPSINFO myUPS; extern UPSINFO *core_ups; extern char argvalue[MAXSTRING]; -extern void (*error_out)(const char *file, int line, const char *fmt,...); -extern void (*error_exit)(const char *fmt,...); -extern void (*error_cleanup)(void); +extern void (*error_out) (const char *file, int line, const char *fmt, ...); +extern void (*error_exit) (const char *fmt, ...); +extern void (*error_cleanup) (void); extern UPSCOMMANDS ups_event[]; extern UPSCMDMSG event_msg[]; -/* - * Serial bits - */ +/* Serial bits */ extern int le_bit; extern int dtr_bit; extern int rts_bit; @@ -60,18 +49,14 @@ extern int rng_bit; extern int dsr_bit; -/* - * File opened - */ +/* File opened */ extern int flags; extern struct termios newtio; extern int debug_net; -/* - * getopt flags (see apcoptd.c) - */ +/* getopt flags (see apcoptd.c) */ extern int show_version; extern char *cfgfile; extern int configure_ups; @@ -84,32 +69,24 @@ extern int go_background; -/* - * In apceeprom.c - */ +/* In apceeprom.c */ extern int do_eeprom_programming(UPSINFO *ups); -/* - * In apcopt.c - */ +/* In apcopt.c */ extern int parse_options(int argc, char *argv[]); -/* - * In apcupsd.c - */ -extern void powerfail (int ok); -extern void logonfail (int ok); +/* In apcupsd.c */ +extern void powerfail(int ok); +extern void logonfail(int ok); -extern void apc_thread_terminate (int sig); +extern void apc_thread_terminate(int sig); extern void clean_threads(void); -extern void apcupsd_terminate (int sig); -extern void clear_files (void); -extern void make_pid (void); +extern void apcupsd_terminate(int sig); +extern void clear_files(void); +extern void make_pid(void); -/* - * In apcdevice.c - */ +/* In apcdevice.c */ void setup_device(UPSINFO *ups); extern void setup_serial(UPSINFO *ups); extern void kill_power(UPSINFO *ups); @@ -118,143 +95,115 @@ extern void prep_device(UPSINFO *ups); extern void do_device(UPSINFO *ups); -/* - * In apcaction.c - */ +/* In apcaction.c */ extern void timer_action(int sig); extern void do_action(UPSINFO *ups); extern void generate_event(UPSINFO *ups, int event); -/* - * In apclock.c - */ -extern int create_lockfile (UPSINFO *ups); -extern void delete_lockfile (UPSINFO *ups); +/* In apclock.c */ +extern int create_lockfile(UPSINFO *ups); +extern void delete_lockfile(UPSINFO *ups); -/* - * In apcnet.c - */ -extern int write_struct_net (int wsocketfd, struct netdata *write_struct, size_t size); -extern int read_struct_net (int rsocketfd, struct netdata *read_struct, size_t size); -extern void log_struct (struct netdata *logstruct); +/* In apcnet.c */ +extern int write_struct_net(int wsocketfd, struct netdata *write_struct, + size_t size); +extern int read_struct_net(int rsocketfd, struct netdata *read_struct, size_t size); +extern void log_struct(struct netdata *logstruct); -extern int reconnect_master (UPSINFO *ups, int who); -extern int prepare_master (UPSINFO *ups); +extern int reconnect_master(UPSINFO *ups, int who); +extern int prepare_master(UPSINFO *ups); -extern int reconnect_slave (UPSINFO *ups); -extern int prepare_slave (UPSINFO *ups); -extern void kill_net (UPSINFO *ups); +extern int reconnect_slave(UPSINFO *ups); +extern int prepare_slave(UPSINFO *ups); +extern void kill_net(UPSINFO *ups); -extern void timer_net (int sig); +extern void timer_net(int sig); extern void do_net(UPSINFO *ups); -extern void timer_slaves (int sig); +extern void timer_slaves(int sig); extern void do_slaves(UPSINFO *ups); -/* - * In apcfile.c - */ +/* In apcfile.c */ extern int make_file(UPSINFO *ups, const char *path); extern void make_pid_file(void); -/* - * In apcpipe.c - */ -extern void sig_fifo_alarm (int sig); -extern int pipe_requests (UPSINFO *ups); -extern int pipe_reconfig (UPSINFO *ups, CONFIGINFO *config); -extern int pipe_master_status (UPSINFO *ups); -extern int pipe_call_shutdown (UPSINFO *ups); -extern int pipe_slave_reconnect (UPSINFO *ups); -extern int pipe_slave_release (UPSINFO *ups); +/* In apcpipe.c */ +extern void sig_fifo_alarm(int sig); +extern int pipe_requests(UPSINFO *ups); +extern int pipe_reconfig(UPSINFO *ups, CONFIGINFO * config); +extern int pipe_master_status(UPSINFO *ups); +extern int pipe_call_shutdown(UPSINFO *ups); +extern int pipe_slave_reconnect(UPSINFO *ups); +extern int pipe_slave_release(UPSINFO *ups); -/* - * In apcconfig.c - */ +/* In apcconfig.c */ extern int slave_count; extern SLAVEINFO slaves[MAXSLAVES]; extern void init_ups_struct(UPSINFO *ups); extern void check_for_config(UPSINFO *ups, char *cfgfile); -/* - * In apcsetup.c - */ -extern void setup_ups_name (UPSINFO *ups); -extern void setup_ups_replace (UPSINFO *ups); +/* In apcsetup.c */ +extern void setup_ups_name(UPSINFO *ups); +extern void setup_ups_replace(UPSINFO *ups); -extern char *setup_ups_string (UPSINFO *ups, char cmd, char *setting); -extern int setup_ups_single (UPSINFO *ups, char cmd, int single); -extern int setup_ups_bubble (UPSINFO *ups, char cmd, int setting); +extern char *setup_ups_string(UPSINFO *ups, char cmd, char *setting); +extern int setup_ups_single(UPSINFO *ups, char cmd, int single); +extern int setup_ups_bubble(UPSINFO *ups, char cmd, int setting); -extern void setup_ups_sensitivity (UPSINFO *ups); -extern void setup_ups_wakeup (UPSINFO *ups); -extern void setup_ups_sleep (UPSINFO *ups); -extern void setup_ups_lo_xfer (UPSINFO *ups); -extern void setup_ups_hi_xfer (UPSINFO *ups); -extern void setup_ups_chargepoint (UPSINFO *ups); -extern void setup_ups_alarm (UPSINFO *ups); -extern void setup_ups_lowbatt_delay (UPSINFO *ups); -extern void setup_ups_selftest (UPSINFO *ups); +extern void setup_ups_sensitivity(UPSINFO *ups); +extern void setup_ups_wakeup(UPSINFO *ups); +extern void setup_ups_sleep(UPSINFO *ups); +extern void setup_ups_lo_xfer(UPSINFO *ups); +extern void setup_ups_hi_xfer(UPSINFO *ups); +extern void setup_ups_chargepoint(UPSINFO *ups); +extern void setup_ups_alarm(UPSINFO *ups); +extern void setup_ups_lowbatt_delay(UPSINFO *ups); +extern void setup_ups_selftest(UPSINFO *ups); extern void get_apc_model(UPSINFO *ups); extern void get_apc_capabilities(UPSINFO *ups); -extern void read_extended (UPSINFO *ups); -extern void setup_extended(UPSINFO *ups); +extern void read_extended(UPSINFO *ups); +extern void setup_extended(UPSINFO *ups); -/* - * In apcnis.c - */ +/* In apcnis.c */ extern void do_server(UPSINFO *ups); extern int check_wrappers(char *av, int newsock); -/* - * In apcstatus.c - */ -extern int output_status (UPSINFO *ups, int fd, void s_open(UPSINFO *ups), - void s_write(UPSINFO *ups, char *fmt,...), - int s_close(UPSINFO *ups, int fd)); +/* In apcstatus.c */ +extern int output_status(UPSINFO *ups, int fd, void s_open(UPSINFO * ups), + void s_write(UPSINFO *ups, char *fmt, ...), int s_close(UPSINFO * ups, int fd)); extern void stat_open(UPSINFO *ups); extern int stat_close(UPSINFO *ups, int fd); extern void stat_print(UPSINFO *ups, char *fmt, ...); -/* - * In apcevents.c - */ +/* In apcevents.c */ extern int trim_eventfile(UPSINFO *ups); extern int output_events(int sockfd, FILE *events_file); -/* - * In apcreports.c - */ +/* In apcreports.c */ extern void clear_files(void); -extern int log_status (UPSINFO *ups); +extern int log_status(UPSINFO *ups); -extern void timer_reports (int sig); -extern void do_reports (UPSINFO *ups); +extern void timer_reports(int sig); +extern void do_reports(UPSINFO *ups); -/* - * In apcsmart.c - */ +/* In apcsmart.c */ extern int apc_enable(UPSINFO *ups); -extern int getline (char *s, int len, UPSINFO *ups); -extern void UPSlinkCheck (UPSINFO *ups); -extern char *smart_poll (char cmd, UPSINFO *ups); -extern int fillUPS (UPSINFO *ups); +extern int getline(char *s, int len, UPSINFO *ups); +extern void UPSlinkCheck(UPSINFO *ups); +extern char *smart_poll(char cmd, UPSINFO *ups); +extern int fillUPS(UPSINFO *ups); -/* - * In apcsignal.c - */ -extern void init_timer (int timer, void (*fnhandler)(int)); -extern void init_signals(void (*handler)(int)); +/* In apcsignal.c */ +extern void init_timer(int timer, void (*fnhandler) (int)); +extern void init_signals(void (*handler) (int)); extern void init_thread_signals(void); extern void restore_signals(void); extern void sleep_forever(void); -/* - * In apcipc.c - */ +/* In apcipc.c */ extern UPSINFO *new_ups(void); extern UPSINFO *attach_ups(UPSINFO *ups, int shmperm); extern int detach_ups(UPSINFO *ups); @@ -271,65 +220,49 @@ extern int _write_lock(char *file, int line, UPSINFO *ups); extern int _write_unlock(char *file, int line, UPSINFO *ups); -/* - * In apcexec.c - */ -extern int start_thread(UPSINFO *ups, void(*action)(UPSINFO *ups), - char *proctitle, char *argv0); +/* In apcexec.c */ +extern int start_thread(UPSINFO *ups, void (*action) (UPSINFO * ups), + char *proctitle, char *argv0); extern int execute_command(UPSINFO *ups, UPSCOMMANDS cmd); -extern void wait_for_termination (int serial_pid); +extern void wait_for_termination(int serial_pid); -/* - * In apclog.c - */ -extern void log_event (const UPSINFO *ups, int level, const char *fmt, ...); +/* In apclog.c */ +extern void log_event(const UPSINFO *ups, int level, const char *fmt, ...); -/* - * In apcproctitle.c - */ +/* In apcproctitle.c */ #ifndef HAVE_SETPROCTITLE extern void init_proctitle(char *a0); extern int setproctitle(char *fmt, ...); #endif -/* - * In apcnetlib.c - */ +/* In apcnetlib.c */ extern int net_open(char *host, char *service, int port); extern void net_close(int sockfd); extern int net_send(int sockfd, char *buff, int len); extern int net_recv(int sockfd, char *buff, int maxlen); -/* - * In apclist.c - */ +/* In apclist.c */ extern int insertUps(UPSINFO *ups); extern UPSINFO *getNextUps(UPSINFO *ups); extern UPSINFO *getUpsByname(char *name); -/* - * In apcerror.c - */ +/* In apcerror.c */ extern void generic_error_out(const char *file, int line, const char *fmt, ...); extern void generic_error_exit(const char *fmt, ...); -/* - * In asys.c - */ +/* In asys.c */ int amicrosleep(time_t sec, long usec); int avsnprintf(char *str, size_t size, const char *format, va_list ap); -int asnprintf(char *str, size_t size, const char *fmt, ...); +int asnprintf(char *str, size_t size, const char *fmt, ...); char *astrncpy(char *dest, const char *src, int maxlen); char *astrncat(char *dest, const char *src, int maxlen); struct tm *localtime_r(const time_t *timep, struct tm *tm); char *afgets(char *s, int size, FILE *fd); void *amalloc(size_t size); -void *arealloc (void *buf, size_t size); -void *acalloc (size_t size1, size_t size2); +void *arealloc(void *buf, size_t size); +void *acalloc(size_t size1, size_t size2); -/* - * In apcwinipc.c - */ +/* In apcwinipc.c */ int winioctl(int fd, int func, int *addr); -#endif /* _APC_EXTERN_H */ +#endif /* _APC_EXTERN_H */ |