mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-07 00:01:49 -04:00
status: Move status_t type and functions to separate files
This commit is contained in:
parent
001a22e2c1
commit
1e02eddb72
@ -41,7 +41,7 @@ utils/utils.c utils/chunk.c utils/debug.c utils/enum.c utils/identification.c \
|
|||||||
utils/lexparser.c utils/optionsfrom.c utils/capabilities.c utils/backtrace.c \
|
utils/lexparser.c utils/optionsfrom.c utils/capabilities.c utils/backtrace.c \
|
||||||
utils/parser_helper.c utils/test.c utils/process.c utils/utils/strerror.c \
|
utils/parser_helper.c utils/test.c utils/process.c utils/utils/strerror.c \
|
||||||
utils/utils/atomics.c utils/utils/string.c utils/utils/memory.c \
|
utils/utils/atomics.c utils/utils/string.c utils/utils/memory.c \
|
||||||
utils/utils/tty.c utils/utils/path.c
|
utils/utils/tty.c utils/utils/path.c utils/utils/status.c
|
||||||
|
|
||||||
libstrongswan_la_SOURCES += \
|
libstrongswan_la_SOURCES += \
|
||||||
threading/thread.c \
|
threading/thread.c \
|
||||||
|
@ -39,7 +39,7 @@ utils/utils.c utils/chunk.c utils/debug.c utils/enum.c utils/identification.c \
|
|||||||
utils/lexparser.c utils/optionsfrom.c utils/capabilities.c utils/backtrace.c \
|
utils/lexparser.c utils/optionsfrom.c utils/capabilities.c utils/backtrace.c \
|
||||||
utils/parser_helper.c utils/test.c utils/process.c utils/utils/strerror.c \
|
utils/parser_helper.c utils/test.c utils/process.c utils/utils/strerror.c \
|
||||||
utils/utils/atomics.c utils/utils/string.c utils/utils/memory.c \
|
utils/utils/atomics.c utils/utils/string.c utils/utils/memory.c \
|
||||||
utils/utils/tty.c utils/utils/path.c
|
utils/utils/tty.c utils/utils/path.c utils/utils/status.c
|
||||||
|
|
||||||
if !USE_WINDOWS
|
if !USE_WINDOWS
|
||||||
libstrongswan_la_SOURCES += \
|
libstrongswan_la_SOURCES += \
|
||||||
@ -110,7 +110,8 @@ utils/printf_hook/printf_hook_vstr.h utils/printf_hook/printf_hook_builtin.h \
|
|||||||
utils/parser_helper.h utils/test.h utils/integrity_checker.h utils/process.h \
|
utils/parser_helper.h utils/test.h utils/integrity_checker.h utils/process.h \
|
||||||
utils/utils/strerror.h utils/compat/windows.h utils/compat/apple.h \
|
utils/utils/strerror.h utils/compat/windows.h utils/compat/apple.h \
|
||||||
utils/utils/atomics.h utils/utils/types.h utils/utils/byteorder.h \
|
utils/utils/atomics.h utils/utils/types.h utils/utils/byteorder.h \
|
||||||
utils/utils/string.h utils/utils/memory.h utils/utils/tty.h utils/utils/path.h
|
utils/utils/string.h utils/utils/memory.h utils/utils/tty.h utils/utils/path.h \
|
||||||
|
utils/utils/status.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
library.lo : $(top_builddir)/config.status
|
library.lo : $(top_builddir)/config.status
|
||||||
|
@ -39,21 +39,6 @@
|
|||||||
#include <threading/mutex.h>
|
#include <threading/mutex.h>
|
||||||
#include <threading/condvar.h>
|
#include <threading/condvar.h>
|
||||||
|
|
||||||
ENUM(status_names, SUCCESS, NEED_MORE,
|
|
||||||
"SUCCESS",
|
|
||||||
"FAILED",
|
|
||||||
"OUT_OF_RES",
|
|
||||||
"ALREADY_DONE",
|
|
||||||
"NOT_SUPPORTED",
|
|
||||||
"INVALID_ARG",
|
|
||||||
"NOT_FOUND",
|
|
||||||
"PARSE_ERROR",
|
|
||||||
"VERIFY_ERROR",
|
|
||||||
"INVALID_STATE",
|
|
||||||
"DESTROY_ME",
|
|
||||||
"NEED_MORE",
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
@ -299,22 +284,6 @@ bool return_false()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns FAILED
|
|
||||||
*/
|
|
||||||
status_t return_failed()
|
|
||||||
{
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns SUCCESS
|
|
||||||
*/
|
|
||||||
status_t return_success()
|
|
||||||
{
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nop operation
|
* nop operation
|
||||||
*/
|
*/
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
#include "utils/string.h"
|
#include "utils/string.h"
|
||||||
#include "utils/memory.h"
|
#include "utils/memory.h"
|
||||||
#include "utils/strerror.h"
|
#include "utils/strerror.h"
|
||||||
|
#include "utils/status.h"
|
||||||
#include "utils/path.h"
|
#include "utils/path.h"
|
||||||
#include "utils/tty.h"
|
#include "utils/tty.h"
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -276,78 +277,6 @@ void utils_deinit();
|
|||||||
*/
|
*/
|
||||||
#define TIME_32_BIT_SIGNED_MAX 0x7fffffff
|
#define TIME_32_BIT_SIGNED_MAX 0x7fffffff
|
||||||
|
|
||||||
typedef enum status_t status_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return values of function calls.
|
|
||||||
*/
|
|
||||||
enum status_t {
|
|
||||||
/**
|
|
||||||
* Call succeeded.
|
|
||||||
*/
|
|
||||||
SUCCESS,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call failed.
|
|
||||||
*/
|
|
||||||
FAILED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Out of resources.
|
|
||||||
*/
|
|
||||||
OUT_OF_RES,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The suggested operation is already done
|
|
||||||
*/
|
|
||||||
ALREADY_DONE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Not supported.
|
|
||||||
*/
|
|
||||||
NOT_SUPPORTED,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One of the arguments is invalid.
|
|
||||||
*/
|
|
||||||
INVALID_ARG,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Something could not be found.
|
|
||||||
*/
|
|
||||||
NOT_FOUND,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error while parsing.
|
|
||||||
*/
|
|
||||||
PARSE_ERROR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error while verifying.
|
|
||||||
*/
|
|
||||||
VERIFY_ERROR,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object in invalid state.
|
|
||||||
*/
|
|
||||||
INVALID_STATE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy object which called method belongs to.
|
|
||||||
*/
|
|
||||||
DESTROY_ME,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Another call to the method is required.
|
|
||||||
*/
|
|
||||||
NEED_MORE,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* enum_names for type status_t.
|
|
||||||
*/
|
|
||||||
extern enum_name_t *status_names;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle struct timeval like an own type.
|
* Handle struct timeval like an own type.
|
||||||
*/
|
*/
|
||||||
@ -438,16 +367,6 @@ bool return_true();
|
|||||||
*/
|
*/
|
||||||
bool return_false();
|
bool return_false();
|
||||||
|
|
||||||
/**
|
|
||||||
* returns FAILED
|
|
||||||
*/
|
|
||||||
status_t return_failed();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns SUCCESS
|
|
||||||
*/
|
|
||||||
status_t return_success();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the padding required to make size a multiple of alignment
|
* Get the padding required to make size a multiple of alignment
|
||||||
*/
|
*/
|
||||||
|
48
src/libstrongswan/utils/utils/status.c
Normal file
48
src/libstrongswan/utils/utils/status.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008-2014 Tobias Brunner
|
||||||
|
* Copyright (C) 2005-2008 Martin Willi
|
||||||
|
* Hochschule fuer Technik Rapperswil
|
||||||
|
*
|
||||||
|
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <utils/utils.h>
|
||||||
|
|
||||||
|
ENUM(status_names, SUCCESS, NEED_MORE,
|
||||||
|
"SUCCESS",
|
||||||
|
"FAILED",
|
||||||
|
"OUT_OF_RES",
|
||||||
|
"ALREADY_DONE",
|
||||||
|
"NOT_SUPPORTED",
|
||||||
|
"INVALID_ARG",
|
||||||
|
"NOT_FOUND",
|
||||||
|
"PARSE_ERROR",
|
||||||
|
"VERIFY_ERROR",
|
||||||
|
"INVALID_STATE",
|
||||||
|
"DESTROY_ME",
|
||||||
|
"NEED_MORE",
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns FAILED
|
||||||
|
*/
|
||||||
|
status_t return_failed()
|
||||||
|
{
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns SUCCESS
|
||||||
|
*/
|
||||||
|
status_t return_success()
|
||||||
|
{
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
72
src/libstrongswan/utils/utils/status.h
Normal file
72
src/libstrongswan/utils/utils/status.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008-2014 Tobias Brunner
|
||||||
|
* Copyright (C) 2008 Martin Willi
|
||||||
|
* Hochschule fuer Technik Rapperswil
|
||||||
|
*
|
||||||
|
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup status_i status
|
||||||
|
* @{ @ingroup utils_i
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STATUS_H_
|
||||||
|
#define STATUS_H_
|
||||||
|
|
||||||
|
typedef enum status_t status_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return values of function calls.
|
||||||
|
*/
|
||||||
|
enum status_t {
|
||||||
|
/** Call succeeded */
|
||||||
|
SUCCESS,
|
||||||
|
/** Call failed */
|
||||||
|
FAILED,
|
||||||
|
/** Out of resources */
|
||||||
|
OUT_OF_RES,
|
||||||
|
/** The suggested operation is already done */
|
||||||
|
ALREADY_DONE,
|
||||||
|
/** Not supported */
|
||||||
|
NOT_SUPPORTED,
|
||||||
|
/** One of the arguments is invalid */
|
||||||
|
INVALID_ARG,
|
||||||
|
/** Something could not be found */
|
||||||
|
NOT_FOUND,
|
||||||
|
/** Error while parsing */
|
||||||
|
PARSE_ERROR,
|
||||||
|
/** Error while verifying */
|
||||||
|
VERIFY_ERROR,
|
||||||
|
/** Object in invalid state */
|
||||||
|
INVALID_STATE,
|
||||||
|
/** Destroy object which called method belongs to */
|
||||||
|
DESTROY_ME,
|
||||||
|
/** Another call to the method is required */
|
||||||
|
NEED_MORE,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum_names for type status_t.
|
||||||
|
*/
|
||||||
|
extern enum_name_t *status_names;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns FAILED
|
||||||
|
*/
|
||||||
|
status_t return_failed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns SUCCESS
|
||||||
|
*/
|
||||||
|
status_t return_success();
|
||||||
|
|
||||||
|
#endif /** STATUS_H_ @} */
|
Loading…
x
Reference in New Issue
Block a user