/*----------------------------------------------------------------------------*/
/*                                                                            */
/*  Copyright (c) 1996 -  2001 by                                             */
/*  blaxxun interactive Inc, San Francisco, California, USA                   */
/*  All rights reserved                                                       */
/*                                                                            */
/*  This software is furnished under a license  and may be  used and  copied  */
/*  only in  accordance of the  terms of such license and with the inclusion  */
/*  of the above copyright notice.  This software or any other copies therof  */
/*  may not be provided or otherwise made available to any other person.  No  */
/*  title to and ownership of the software is hereby transferred.             */
/*                                                                            */
/*  The information in this software is subject to change without notice and  */
/*  should not be construed as a commitment by blaxxun interactive Inc.       */
/*                                                                            */
/*----------------------------------------------------------------------------*/

/*
--------------------------------------------------------------------------------

  MODULE NAME:  $RCSfile: rantserv.h,v $
  REVISION:     $Revision: 1.2 $
  DATE:         $Date: 2001/02/15 17:47:38 $
  AUTHOR:       $Author: peter $
  STATE:        $State: Exp $

  CREATION DATE:       Jan 5, 1997

  =DocStart= Module rantserv.h

  PROJECT:            VWP         - blaxxun virtual worlds platform
  SYSTEM:             server      - server processes
  COMPONENT:          apserver    - Community Server API server

  DESCRIPTION:
      include file for NT services stuff

  =DocEnd=

--------------------------------------------------------------------------------
*/

#ifndef _RANTSERV_H_
#define _RANTSERV_H_

/*
 * make it an extern C declararation for CPLUSPLUS
 */
#ifdef __cplusplus
extern "C" {
#endif

static char * _RANTSERV_H_rcsid = "$Id: rantserv.h,v 1.2 2001/02/15 17:47:38 peter Exp $";

/*
 * the following function is needed to suppress compiler warnings, don't call it
 */
static void _RANTSERV_H_rcsid_fkt()
{
    if( ! *_RANTSERV_H_rcsid )
        *_RANTSERV_H_rcsid = 0;
    if( 0 )
        _RANTSERV_H_rcsid_fkt();
}

/*----------------------------------------------------------------------------*/
/*             GLOBAL INCLUDE FILES                                           */
/*----------------------------------------------------------------------------*/
#include "ivntserv.h"

/*----------------------------------------------------------------------------*/
/*             MACROS/CONSTANTS                                               */
/*----------------------------------------------------------------------------*/

/*
 * Services Names we use for the RA server on NT
 */
#define RANT_SERVICE_NAME        "raserver"

/*----------------------------------------------------------------------------*/
/*             FUNCTION PROTOTYPES                                            */
/*----------------------------------------------------------------------------*/

extern void ivsrun(
char           *server,                /* server structure to run on         */
int             psocket,               /* socket to listen to                */
struct timeval *pperiod,               /* period for periodic function       */
void (*pperiodic)(                     /* periodic function to call          */
                   char  *,            /* server structure to run on         */
                   struct timeval*     /* current time at call               */
                 ),
void (*preply)(                        /* packet reply function called       */
                char           *,      /* server structure to run on         */
                struct timeval *,      /* current time at call               */
                char *,                /* the packet                         */
                int,                   /* the length of the packet           */
                char *,                /* the sender address                 */
                int                    /* the length of that address         */
              ),
void (*psignal) (                      /* function called on signals         */
                   char *,             /* server structure to run on         */
                   struct timeval*,    /* current time at call               */
                   FILE *f             /* a file to print to                 */
                ),
FILE *pfile,                           /* file descriptor passed to psignal  */
void (*phourly)(                       /* function to call every hour        */
                   char  *,            /* server structure to run on         */
                   struct timeval*     /* current time at call               */
               )
);

extern int ra_initfct(
int        * argc,                      /* command line arguments           */
char       * argv[],
raserver_t * raserver,                  /* server structure to fill         */
char       * usage                      /* usage string to print            */
);

extern void ra_exitproc(
raserver_t      * raserver,             /* r: server to run on              */
int exitrc
);

extern void raserver_periodic(
char           * pserver,               /* server to run on                 */
struct timeval * now                    /* time when function was called    */
);

extern void raserver_hourly(
char           * pserver,               /* server to run on                 */
struct timeval * now                    /* time when function was called    */
);

extern void raserver_status_print(
char          * pserver,             /* r: server to run on              */
struct timeval* now,
FILE * f
);

extern void raserver_reply(
char           * pserver,               /* server to run on                 */
struct timeval * now,                   /* r: time of wake up               */
char           * packet,                /* r: packet received               */
int              packetlen,             /* r: length of that packet         */
char           * sender,                /* r: socket address of sender      */
int              senderlen              /* r: length of that address        */
);

#ifdef __cplusplus
}
#endif

#endif

