/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2025 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQHOME_DATA_SERVER_P_H
#define AQHOME_DATA_SERVER_P_H


#include "./server.h"

#include <aqhome/events2/object.h>

#include <gwenhywfar/mutex.h>


#define AQHOME_DATA_DEFAULT_PIDFILE           "/var/run/aqhome-data.pid"
#define AQHOME_DATA_DEFAULT_DATADIR           "/var/lib/aqhome-data/data"
#define AQHOME_DATA_DEFAULT_IPC_PORT          45456

#define AQHOME_DATA_STATEFILENAME             "statefile"



typedef struct AQHOME_SERVER AQHOME_SERVER;
struct AQHOME_SERVER {
  AQH_OBJECT *ipcServer;
  AQH_OBJECT_LIST *tcpClientList;

  AQH_MSG_REQUEST *requestTree;

  GWEN_DB_NODE *dbArgs;
  AQH_STORAGE *storage;
  char *pidFile;
  int timeout;   /* timeout for run e.g. inside valgrind */
  GWEN_MUTEX *storageMutex;
};


AQHOME_SERVER *AqHomeDataServer_GetServerData(const AQH_OBJECT *o);



#endif


