/****************************************************************************

   mod_dav_pgsql (DASL) for apache 2.X
   CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
   CopyRight(C) 2006 Netomi Inc. All Rights reserved.
   Author : elenoa lazyfake (elenoa@solutionbox.co.kr)

   $Id: share.h,v 1.6 2007/03/19 08:43:12 elenoa Exp $

   Redistribution and use in source and binary forms, with or with out
   modification, are not permitted in outside of SolutionBox Inc.

 ****************************************************************************/

#ifndef __SHARE_COMMON_H__
#define __SHARE_COMMON_H__

#define DOMAIN_SIZE			512
#define URI_SIZE_MAX        2048


#define SHM_ANON            "/tmp/opendav.shared.anony.shm"
#define SHM_ANON_LOCK       "/tmp/opendav.shared.anony.lock"

#define SHM_UCAH            "/tmp/opendav.shared.account.shm"
#define SHM_UCAH_LOCK       "/tmp/opendav.shared.account.lock"

#define SHM_FHS	            "/tmp/opendav.shared.fhsstat.shm"
#define SHM_FHS_LOCK        "/tmp/opendav.shared.fhsstat.lock"

#define SHM_FHSCNT           "/tmp/opendav.shared.fhscount.shm"
#define SHM_FHSCNT_LOCK      "/tmp/opendav.shared.fhscount.lock"

#ifndef __OPENDISK_SOLUTION_NOT_USE_TS__
#define SHM_STAT            "/tmp/opendav.shared.networkstat.shm"
#define SHM_STAT_LOCK       "/tmp/opendav.shared.networkstat.lock"
#endif // !__OPENDISK_SOLUTION_NOT_USE_TS__


struct shm_mgnt {
	apr_shm_t *shm;
	apr_global_mutex_t *lock;
	const char *shm_key;
	const char *lock_key;
	int size;
	int number;
};

struct time_slice {
	apr_uint64_t sent[24];
};

int dav_initialize_shared_memory(server_rec *s, apr_pool_t *p);
apr_status_t dav_cleanup_shared_memory(void *data);

void *dav_shared_get_new_memory(struct shm_mgnt *mgnt, server_rec *s, apr_pool_t *p, bool block);

// 2014.06.04 dadamin
// 메타 정보 테이블
char* dav_get_target_table(const char *tranid, char * buf);

// uri 값 대신 display name 사용 유무
// 0: uri 사용, 1: dispaly name 사용, -1: error
int dav_use_display_name();

#endif //__SHARE_COMMON_H__

