/* Timesync defines
   Rick Smereka, Copyright (C) 2001-2003.

   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, get a copy via the Internet at
   http://gnu.org/copyleft/gpl.html or write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   MA 02111-1307 USA

   You can contact the author via email at rsmereka@future-lab.com

   Original QNX version. Nov/2001, Rick Smereka

   Ported to Debian Linux. Nov/2002, Rick Smereka

   Added send codes 'TS_SEND_TRANS_NUM' and 'TS_SEND_CONNECT_NUM'.
   Added error code 'TS_NOT_IMPLEMENTED'. Added function prototypes
   'timesync_end', 'timesync_trans_num' and 'timesync_connect_num'. 
   Jun/2003, Rick Smereka */

/* client/server return/reply codes */

#define TS_OK SOCKET_RC_OK
#define TS_VC_ERROR SOCKET_RC_VC_ERROR
#define TS_ACCESS_DENIED 1
#define TS_MEMORY_FAIL 2
#define TS_INVALID_FUNCTION 3
#define TS_INTERNAL_ERROR 4
#define TS_INVALID_PARAMETER 5
#define TS_LOG_ALREADY_OFF 6
#define TS_LOG_ALREADY_ON 7
#define TS_NO_SERVER 8
#define TS_NOT_FOUND 9
#define TS_LOG_ERROR 10
#define TS_SOCLOC_NO_INIT 11
#define TS_NOT_IMPLEMENTED 12

/* send messages */

#define TS_SEND_GET_DATIME 20
#define TS_SEND_TERM SOCKET_SEND_TERM
#define TS_SEND_STATUS SOCKET_SEND_STATUS
#define TS_SEND_LOG_OFF SOCKET_SEND_LOG_OFF
#define TS_SEND_LOG_ON SOCKET_SEND_LOG_ON
#define TS_SEND_LOG_STATUS SOCKET_SEND_LOG_STATUS
#define TS_SEND_SERVICE_NAME SOCKET_SEND_SERVICE_NAME
#define TS_SEND_VERSION SOCKET_SEND_VERSION
#define TS_SEND_TRANS_NUM SOCKET_SEND_TRANS_NUM
#define TS_SEND_CONNECT_NUM SOCKET_SEND_CONNECT_NUM

/* maximum size of socket send/receive buffer */

#define TS_MAXCOMMAND 1024

/* service name for 'socloc' (TCP) or 'nameloc' (QNX message passing) */

#ifdef IPC_TCP
#define TS_SERVICE_NAME "timesync"
#else
#define TS_SERVICE_NAME "/timesync"
#endif

/* timesync API function prototypes */

#ifdef __cplusplus
extern "C"
{
#endif

int timesync_init(void);
void timesync_end(void);
int timesync_get_datime(int *, int *, int *, int *, int *, int *);
int timesync_status(void);
int timesync_stop(char *);
int timesync_log_off(void);
int timesync_log_on(char *);
int timesync_log_status(int *, char *);
int timesync_service_name(char *);
int timesync_version(char *);
int timesync_trans_num(long *);
int timesync_connect_num(int *);
#ifdef IPC_TCP
void timesync_get_active(char *, int *);
#endif

/* error translation function in tlogcode.c */

void ts_code_string(int, char *);

#ifdef __cplusplus
}
#endif
