mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
New "instance.h" header
Remove unused
This commit is contained in:
parent
53d5a8734b
commit
d228165814
@ -6,6 +6,7 @@ HDRS= fifo.h \
|
||||
overlay_interface.h \
|
||||
rhizome.h \
|
||||
httpd.h \
|
||||
instance.h \
|
||||
meshms.h \
|
||||
serval.h \
|
||||
keyring.h \
|
||||
|
@ -36,13 +36,6 @@ const char *serval_instancepath()
|
||||
return instancepath;
|
||||
}
|
||||
|
||||
void serval_setinstancepath(const char *instancepath)
|
||||
{
|
||||
if (thisinstancepath == NULL)
|
||||
free(thisinstancepath);
|
||||
thisinstancepath = strdup(instancepath);
|
||||
}
|
||||
|
||||
int formf_serval_instance_path(struct __sourceloc __whence, char *buf, size_t bufsiz, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
54
instance.h
Normal file
54
instance.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Serval DNA header file - system paths
|
||||
Copyright (C) 2014 Serval Project Inc.
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVAL_DNA__INSTANCE_H
|
||||
#define __SERVAL_DNA__INSTANCE_H
|
||||
|
||||
#include "log.h"
|
||||
|
||||
/*
|
||||
* A default INSTANCE_PATH can be set on the ./configure command line, eg:
|
||||
*
|
||||
* ./configure INSTANCE_PATH=/var/local/serval/node
|
||||
*
|
||||
* This will cause servald to never use FHS paths, and always use an instance
|
||||
* path, even if the SERVALINSTANCE_PATH environment variable is not set.
|
||||
*/
|
||||
#ifdef INSTANCE_PATH
|
||||
#define DEFAULT_INSTANCE_PATH INSTANCE_PATH
|
||||
#else
|
||||
#ifdef ANDROID
|
||||
#define DEFAULT_INSTANCE_PATH "/data/data/org.servalproject/var/serval-node"
|
||||
#else
|
||||
#define DEFAULT_INSTANCE_PATH NULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Handy statement for forming a path to an instance file in a char buffer whose declaration
|
||||
* is in scope (so that sizeof(buf) will work). Evaluates to true if the pathname fitted into
|
||||
* the provided buffer, false (0) otherwise (after logging an error).
|
||||
*/
|
||||
#define FORM_SERVAL_INSTANCE_PATH(buf, path) (formf_serval_instance_path(__WHENCE__, buf, sizeof(buf), "%s", (path)))
|
||||
|
||||
const char *serval_instancepath();
|
||||
int create_serval_instance_dir();
|
||||
int formf_serval_instance_path(struct __sourceloc, char *buf, size_t bufsiz, const char *fmt, ...) __attribute__((format(printf,4,5)));
|
||||
int vformf_serval_instance_path(struct __sourceloc, char *buf, size_t bufsiz, const char *fmt, va_list);
|
||||
|
||||
#endif // __SERVAL_DNA__INSTANCE_H
|
28
serval.h
28
serval.h
@ -133,6 +133,7 @@ struct in_addr {
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "instance.h"
|
||||
#include "fdqueue.h"
|
||||
#include "cli.h"
|
||||
#include "constants.h"
|
||||
@ -195,33 +196,6 @@ int strn_to_sid_t(sid_t *sid, const char *hex, const char **endp);
|
||||
|
||||
#define alloca_tohex_sas(sas) alloca_tohex((sas), SAS_SIZE)
|
||||
|
||||
/*
|
||||
* INSTANCE_PATH can be set on the ./configure command line, eg:
|
||||
*
|
||||
* ./configure INSTANCE_PATH=/var/local/serval/node
|
||||
*/
|
||||
#ifdef INSTANCE_PATH
|
||||
#define DEFAULT_INSTANCE_PATH INSTANCE_PATH
|
||||
#else
|
||||
#ifdef ANDROID
|
||||
#define DEFAULT_INSTANCE_PATH "/data/data/org.servalproject/var/serval-node"
|
||||
#else
|
||||
#define DEFAULT_INSTANCE_PATH "/var/serval-node"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Handy statement for forming a path to an instance file in a char buffer whose declaration
|
||||
* is in scope (so that sizeof(buf) will work). Evaluates to true if the pathname fitted into
|
||||
* the provided buffer, false (0) otherwise (after logging an error).
|
||||
*/
|
||||
#define FORM_SERVAL_INSTANCE_PATH(buf, path) (formf_serval_instance_path(__WHENCE__, buf, sizeof(buf), "%s", (path)))
|
||||
|
||||
const char *serval_instancepath();
|
||||
int create_serval_instance_dir();
|
||||
int formf_serval_instance_path(struct __sourceloc, char *buf, size_t bufsiz, const char *fmt, ...) __attribute__((format(printf,4,5)));
|
||||
int vformf_serval_instance_path(struct __sourceloc, char *buf, size_t bufsiz, const char *fmt, va_list);
|
||||
void serval_setinstancepath(const char *instancepath);
|
||||
|
||||
#define SERVER_CONFIG_RELOAD_INTERVAL_MS 1000
|
||||
|
||||
struct cli_parsed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user