mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 12:56:29 +00:00
Uniform #ifdef __SERVAL_DNA__... for headers
This commit is contained in:
parent
9b64bb87e0
commit
5226e47ef6
6
cli.h
6
cli.h
@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_CLI_H
|
||||
#define __SERVALD_CLI_H
|
||||
#ifndef __SERVAL_DNA__CLI_H
|
||||
#define __SERVAL_DNA__CLI_H
|
||||
|
||||
#include "xprintf.h"
|
||||
#include "log.h"
|
||||
@ -102,4 +102,4 @@ void cli_put_long(struct cli_context *context, int64_t value, const char *delim)
|
||||
void cli_put_string(struct cli_context *context, const char *value, const char *delim);
|
||||
void cli_put_hexvalue(struct cli_context *context, const unsigned char *value, int length, const char *delim);
|
||||
|
||||
#endif // __SERVALD_CLI_H
|
||||
#endif // __SERVAL_DNA__CLI_H
|
||||
|
6
conf.h
6
conf.h
@ -222,8 +222,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA_CONF_H
|
||||
#define __SERVALDNA_CONF_H
|
||||
#ifndef __SERVAL_DNA__CONF_H
|
||||
#define __SERVAL_DNA__CONF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -701,4 +701,4 @@ int cf_reload();
|
||||
int cf_reload_strict();
|
||||
int cf_reload_permissive();
|
||||
|
||||
#endif //__SERVALDNA_CONF_H
|
||||
#endif //__SERVAL_DNA__CONF_H
|
||||
|
@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_CONSTANTS_H
|
||||
#define __SERVALD_CONSTANTS_H
|
||||
#ifndef __SERVAL_DNA__CONSTANTS_H
|
||||
#define __SERVAL_DNA__CONSTANTS_H
|
||||
|
||||
#define NELS(a) (sizeof (a) / sizeof *(a))
|
||||
|
||||
@ -224,4 +224,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
typedef char bool_t;
|
||||
|
||||
|
||||
#endif // __SERVALD_CONSTANTS_H
|
||||
#endif // __SERVAL_DNA__CONSTANTS_H
|
||||
|
4
crypto.h
4
crypto.h
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_CRYPTO_H
|
||||
#define __SERVALD_CRYPTO_H
|
||||
#ifndef __SERVAL_DNA__CRYPTO_H
|
||||
#define __SERVAL_DNA__CRYPTO_H
|
||||
|
||||
#include "nacl.h"
|
||||
#define SIGNATURE_BYTES crypto_sign_edwards25519sha512batch_BYTES
|
||||
|
@ -16,8 +16,8 @@ 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 __SERVALD_DATA_FORMATS_H
|
||||
#define __SERVALD_DATA_FORMATS_H
|
||||
#ifndef __SERVAL_DNA___DATA_FORMATS_H
|
||||
#define __SERVAL_DNA___DATA_FORMATS_H
|
||||
|
||||
int str_is_subscriber_id(const char *sid);
|
||||
int strn_is_subscriber_id(const char *sid, size_t *lenp);
|
||||
@ -42,4 +42,4 @@ uint64_t read_uint64(const unsigned char *o);
|
||||
uint32_t read_uint32(const unsigned char *o);
|
||||
uint16_t read_uint16(const unsigned char *o);
|
||||
|
||||
#endif
|
||||
#endif //__SERVAL_DNA___DATA_FORMATS_H
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA__FDQUEUE_H
|
||||
#define __SERVALDNA__FDQUEUE_H
|
||||
#ifndef __SERVAL_DNA__FDQUEUE_H
|
||||
#define __SERVAL_DNA__FDQUEUE_H
|
||||
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
@ -91,4 +91,4 @@ unsigned fd_depth();
|
||||
#define RETURNNULL(X) do { X; OUT(); return (NULL); } while (0)
|
||||
#define RETURNVOID do { OUT(); return; } while (0)
|
||||
|
||||
#endif // __SERVALDNA__FDQUEUE_H
|
||||
#endif // __SERVAL_DNA__FDQUEUE_H
|
||||
|
4
golay.h
4
golay.h
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_GOLAY_H
|
||||
#define __SERVALD_GOLAY_H
|
||||
#ifndef __SERVAL_DNA__GOLAY_H
|
||||
#define __SERVAL_DNA__GOLAY_H
|
||||
|
||||
int golay_encode(uint8_t *data);
|
||||
int golay_decode(int *errs, uint8_t *data);
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA__HTTP_SERVER_H
|
||||
#define __SERVALDNA__HTTP_SERVER_H
|
||||
#ifndef __SERVAL_DNA__HTTP_SERVER_H
|
||||
#define __SERVAL_DNA__HTTP_SERVER_H
|
||||
|
||||
#include <limits.h>
|
||||
#include "constants.h"
|
||||
@ -207,4 +207,4 @@ struct http_request {
|
||||
char buffer[8 * 1024];
|
||||
};
|
||||
|
||||
#endif // __SERVALDNA__HTTP_SERVER_H
|
||||
#endif // __SERVAL_DNA__HTTP_SERVER_H
|
||||
|
@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_KEYRING_H
|
||||
#define __SERVALD_KEYRING_H
|
||||
#ifndef __SERVAL_DNA__KEYRING_H
|
||||
#define __SERVAL_DNA__KEYRING_H
|
||||
|
||||
typedef struct keypair {
|
||||
int type;
|
||||
@ -126,4 +126,4 @@ int keyring_find_public_tag_value(const keyring_file *k, int *cn, int *in, int *
|
||||
int keyring_unpack_tag(const unsigned char *packed, size_t packed_len, const char **name, const unsigned char **value, size_t *length);
|
||||
int keyring_pack_tag(unsigned char *packed, size_t *packed_len, const char *name, const unsigned char *value, size_t length);
|
||||
|
||||
#endif // __SERVALD_KEYRING_H
|
||||
#endif // __SERVAL_DNA__KEYRING_H
|
||||
|
6
log.h
6
log.h
@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_LOG_H
|
||||
#define __SERVALD_LOG_H
|
||||
#ifndef __SERVAL_DNA__LOG_H
|
||||
#define __SERVAL_DNA__LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -161,4 +161,4 @@ struct strbuf;
|
||||
|
||||
#define BACKTRACE log_backtrace(LOG_LEVEL_FATAL, __WHENCE__)
|
||||
|
||||
#endif // __SERVALD_LOG_H
|
||||
#endif // __SERVAL_DNA__LOG_H
|
||||
|
@ -16,8 +16,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_MDP_CLIENT_H
|
||||
#define __SERVALD_MDP_CLIENT_H
|
||||
#ifndef __SERVAL_DNA__MDP_CLIENT_H
|
||||
#define __SERVAL_DNA__MDP_CLIENT_H
|
||||
|
||||
#include "serval.h"
|
||||
|
||||
|
6
mem.h
6
mem.h
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA__MEM_H
|
||||
#define __SERVALDNA__MEM_H
|
||||
#ifndef __SERVAL_DNA__MEM_H
|
||||
#define __SERVAL_DNA__MEM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "log.h"
|
||||
@ -69,4 +69,4 @@ char *_strn_edup(struct __sourceloc, const char *str, size_t len);
|
||||
#define str_edup(str) _str_edup(__HERE__, (str))
|
||||
#define strn_edup(str, len) _strn_edup(__HERE__, (str), (len))
|
||||
|
||||
#endif // __SERVALDNA__MEM_H
|
||||
#endif // __SERVAL_DNA__MEM_H
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_MONITOR_CLIENT_H
|
||||
#define __SERVALD_MONITOR_CLIENT_H
|
||||
#ifndef __SERVAL_DNA__MONITOR_CLIENT_H
|
||||
#define __SERVAL_DNA__MONITOR_CLIENT_H
|
||||
|
||||
struct monitor_state;
|
||||
|
||||
|
6
net.h
6
net.h
@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_NET_H
|
||||
#define __SERVALD_NET_H
|
||||
#ifndef __SERVAL_DNA__NET_H
|
||||
#define __SERVAL_DNA__NET_H
|
||||
|
||||
#include <sys/types.h> // for size_t, ssize_t
|
||||
#include <sys/socket.h> // for struct sockaddr, socklen_t
|
||||
@ -53,4 +53,4 @@ ssize_t _writev_all(int fd, const struct iovec *iov, int iovcnt, struct __source
|
||||
ssize_t _write_str(int fd, const char *str, struct __sourceloc __whence);
|
||||
ssize_t _write_str_nonblock(int fd, const char *str, struct __sourceloc __whence);
|
||||
|
||||
#endif // __SERVALD_NET_H
|
||||
#endif // __SERVAL_DNA__NET_H
|
||||
|
2
os.c
2
os.c
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define __SERVALDNA_OS_INLINE
|
||||
#define __SERVAL_DNA__OS_INLINE
|
||||
#include "os.h"
|
||||
#include "str.h"
|
||||
#include "log.h"
|
||||
|
18
os.h
18
os.h
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA_OS_H
|
||||
#define __SERVALDNA_OS_H
|
||||
#ifndef __SERVAL_DNA__OS_H
|
||||
#define __SERVAL_DNA__OS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -26,11 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __SERVALDNA_OS_INLINE
|
||||
#ifndef __SERVAL_DNA__OS_INLINE
|
||||
# if __GNUC__ && !__GNUC_STDC_INLINE__
|
||||
# define __SERVALDNA_OS_INLINE extern inline
|
||||
# define __SERVAL_DNA__OS_INLINE extern inline
|
||||
# else
|
||||
# define __SERVALDNA_OS_INLINE inline
|
||||
# define __SERVAL_DNA__OS_INLINE inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -60,19 +60,19 @@ time_ms_t gettime_ms();
|
||||
time_ms_t sleep_ms(time_ms_t milliseconds);
|
||||
|
||||
#ifndef HAVE_BZERO
|
||||
__SERVALDNA_OS_INLINE void bzero(void *buf, size_t len) {
|
||||
__SERVAL_DNA__OS_INLINE void bzero(void *buf, size_t len) {
|
||||
memset(buf, 0, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_BCOPY
|
||||
__SERVALDNA_OS_INLINE void bcopy(const void *src, void *dst, size_t len) {
|
||||
__SERVAL_DNA__OS_INLINE void bcopy(const void *src, void *dst, size_t len) {
|
||||
memcpy(dst, src, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_BCMP
|
||||
__SERVALDNA_OS_INLINE int bcmp(const void *s1, const void *s2, size_t n) {
|
||||
__SERVAL_DNA__OS_INLINE int bcmp(const void *s1, const void *s2, size_t n) {
|
||||
// bcmp() is only an equality test, not an order test, so its return value
|
||||
// is not specified as negative or positive, only non-zero. Hoewver
|
||||
// memcmp() is an order test. We deliberately discard negative return
|
||||
@ -123,4 +123,4 @@ int urandombytes(unsigned char *buf, size_t len);
|
||||
*/
|
||||
ssize_t read_symlink(const char *path, char *buf, size_t len);
|
||||
|
||||
#endif //__SERVALDNA_OS_H
|
||||
#endif //__SERVAL_DNA__OS_H
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SERVALD_OVERLAY_ADDRESS_H
|
||||
#define _SERVALD_OVERLAY_ADDRESS_H
|
||||
#ifndef __SERVAL_DNA__OVERLAY_ADDRESS_H
|
||||
#define __SERVAL_DNA__OVERLAY_ADDRESS_H
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
@ -130,4 +130,4 @@ int send_please_explain(struct decode_context *context, struct subscriber *sourc
|
||||
|
||||
void free_subscribers();
|
||||
|
||||
#endif
|
||||
#endif //__SERVAL_DNA__OVERLAY_ADDRESS_H
|
||||
|
@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD__OVERLAY_BUFFER_H
|
||||
#define __SERVALD__OVERLAY_BUFFER_H
|
||||
#ifndef __SERVAL_DNA___OVERLAY_BUFFER_H
|
||||
#define __SERVAL_DNA___OVERLAY_BUFFER_H
|
||||
|
||||
struct overlay_buffer {
|
||||
unsigned char *bytes;
|
||||
@ -118,4 +118,4 @@ unsigned char* ob_ptr(struct overlay_buffer *b);
|
||||
|
||||
#define ob_overrun(b) _ob_overrun(__WHENCE__, b)
|
||||
|
||||
#endif //__SERVALD__OVERLAY_BUFFER_H
|
||||
#endif //__SERVAL_DNA___OVERLAY_BUFFER_H
|
||||
|
@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SERVALD_OVERLAY_PACKET_H
|
||||
#define _SERVALD_OVERLAY_PACKET_H
|
||||
#ifndef __SERVAL_DNA__OVERLAY_PACKET_H
|
||||
#define __SERVAL_DNA__OVERLAY_PACKET_H
|
||||
|
||||
#include "overlay_address.h"
|
||||
#include "serval.h"
|
||||
@ -102,4 +102,4 @@ struct overlay_frame {
|
||||
int op_free(struct overlay_frame *p);
|
||||
struct overlay_frame *op_dup(struct overlay_frame *f);
|
||||
|
||||
#endif
|
||||
#endif //__SERVAL_DNA__OVERLAY_PACKET_H
|
||||
|
@ -16,8 +16,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_RADIO_LINK_H
|
||||
#define __SERVALD_RADIO_LINK_H
|
||||
#ifndef __SERVAL_DNA___RADIO_LINK_H
|
||||
#define __SERVAL_DNA___RADIO_LINK_H
|
||||
|
||||
#define HEARTBEAT_SIZE (8+9)
|
||||
#define LINK_MTU 255
|
||||
@ -30,4 +30,4 @@ void radio_link_state_html(struct strbuf *b, struct overlay_interface *interface
|
||||
int radio_link_is_busy(struct overlay_interface *interface);
|
||||
int radio_link_queue_packet(struct overlay_interface *interface, struct overlay_buffer *buffer);
|
||||
|
||||
#endif
|
||||
#endif //__SERVAL_DNA___RADIO_LINK_H
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA__RHIZOME_H
|
||||
#define __SERVALDNA__RHIZOME_H
|
||||
#ifndef __SERVAL_DNA__RHIZOME_H
|
||||
#define __SERVAL_DNA__RHIZOME_H
|
||||
|
||||
#include <sqlite3.h>
|
||||
#include <limits.h>
|
||||
@ -954,4 +954,4 @@ int overlay_mdp_service_rhizome_sync(struct overlay_frame *frame, overlay_mdp_fr
|
||||
int rhizome_sync_announce();
|
||||
int rhizome_sync_bundle_inserted(const unsigned char *bar);
|
||||
|
||||
#endif //__SERVALDNA__RHIZOME_H
|
||||
#endif //__SERVAL_DNA__RHIZOME_H
|
||||
|
6
serval.h
6
serval.h
@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_SERVALD_H
|
||||
#define __SERVALD_SERVALD_H
|
||||
#ifndef __SERVAL_DNA__SERVAL_H
|
||||
#define __SERVAL_DNA__SERVAL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@ -700,4 +700,4 @@ int link_stop_routing(struct subscriber *subscriber);
|
||||
|
||||
int generate_nonce(unsigned char *nonce,int bytes);
|
||||
|
||||
#endif // __SERVALD_SERVALD_H
|
||||
#endif // __SERVAL_DNA__SERVAL_H
|
||||
|
6
socket.h
6
socket.h
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_SOCKET_H
|
||||
#define __SERVALD_SOCKET_H
|
||||
#ifndef __SERVAL_DNA___SOCKET_H
|
||||
#define __SERVAL_DNA___SOCKET_H
|
||||
|
||||
#ifdef WIN32
|
||||
# include "win32/win32.h"
|
||||
@ -85,4 +85,4 @@ ssize_t _recv_message(struct __sourceloc, int fd, struct socket_address *address
|
||||
|
||||
ssize_t recvwithttl(int sock, unsigned char *buffer, size_t bufferlen, int *ttl, struct socket_address *recvaddr);
|
||||
|
||||
#endif
|
||||
#endif // __SERVAL_DNA___SOCKET_H
|
||||
|
2
str.c
2
str.c
@ -17,7 +17,7 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define __SERVAL_DNA_STR_INLINE
|
||||
#define __SERVAL_DNA__STR_INLINE
|
||||
#include "str.h"
|
||||
#include "strbuf_helpers.h"
|
||||
#include "constants.h"
|
||||
|
58
str.h
58
str.h
@ -17,8 +17,8 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVAL_DNA_STR_H__
|
||||
#define __SERVAL_DNA_STR_H__
|
||||
#ifndef __SERVAL_DNA__STR_H__
|
||||
#define __SERVAL_DNA__STR_H__
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
@ -26,11 +26,11 @@
|
||||
#include <ctype.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#ifndef __SERVAL_DNA_STR_INLINE
|
||||
#ifndef __SERVAL_DNA__STR_INLINE
|
||||
# if __GNUC__ && !__GNUC_STDC_INLINE__
|
||||
# define __SERVAL_DNA_STR_INLINE extern inline
|
||||
# define __SERVAL_DNA__STR_INLINE extern inline
|
||||
# else
|
||||
# define __SERVAL_DNA_STR_INLINE inline
|
||||
# define __SERVAL_DNA__STR_INLINE inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -53,7 +53,7 @@ extern const char hexdigit_lower[16];
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
__SERVAL_DNA_STR_INLINE int is_xsubstring(const char *text, int len)
|
||||
__SERVAL_DNA__STR_INLINE int is_xsubstring(const char *text, int len)
|
||||
{
|
||||
while (len--)
|
||||
if (!isxdigit(*text++))
|
||||
@ -66,7 +66,7 @@ __SERVAL_DNA_STR_INLINE int is_xsubstring(const char *text, int len)
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
__SERVAL_DNA_STR_INLINE int is_xstring(const char *text, int len)
|
||||
__SERVAL_DNA__STR_INLINE int is_xstring(const char *text, int len)
|
||||
{
|
||||
while (len--)
|
||||
if (!isxdigit(*text++))
|
||||
@ -209,43 +209,43 @@ extern uint8_t _serval_ctype_0[UINT8_MAX];
|
||||
extern uint8_t _serval_ctype_1[UINT8_MAX];
|
||||
extern uint8_t _serval_ctype_2[UINT8_MAX];
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_http_char(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_http_char(char c) {
|
||||
return isascii(c);
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_http_ctl(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_http_ctl(char c) {
|
||||
return iscntrl(c);
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_base64_digit(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_base64_digit(char c) {
|
||||
return (_serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_base64url_digit(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_base64url_digit(char c) {
|
||||
return (_serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64URL) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_base64_pad(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_base64_pad(char c) {
|
||||
return c == '=';
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_base64url_pad(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_base64url_pad(char c) {
|
||||
return c == '=';
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE uint8_t base64_digit(char c) {
|
||||
__SERVAL_DNA__STR_INLINE uint8_t base64_digit(char c) {
|
||||
return _serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64_MASK;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE uint8_t base64url_digit(char c) {
|
||||
__SERVAL_DNA__STR_INLINE uint8_t base64url_digit(char c) {
|
||||
return _serval_ctype_0[(unsigned char) c] & _SERVAL_CTYPE_0_BASE64_MASK;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_multipart_boundary(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_multipart_boundary(char c) {
|
||||
return (_serval_ctype_2[(unsigned char) c] & _SERVAL_CTYPE_2_MULTIPART_BOUNDARY) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_valid_multipart_boundary_string(const char *s)
|
||||
__SERVAL_DNA__STR_INLINE int is_valid_multipart_boundary_string(const char *s)
|
||||
{
|
||||
if (s[0] == '\0')
|
||||
return 0;
|
||||
@ -255,11 +255,11 @@ __SERVAL_DNA_STR_INLINE int is_valid_multipart_boundary_string(const char *s)
|
||||
return s[-1] != ' ';
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_http_separator(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_http_separator(char c) {
|
||||
return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_HTTP_SEPARATOR) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_http_token(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_http_token(char c) {
|
||||
return is_http_char(c) && !is_http_ctl(c) && !is_http_separator(c);
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ __SERVAL_DNA_STR_INLINE int is_http_token(char c) {
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
__SERVAL_DNA_STR_INLINE int hexvalue(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int hexvalue(char c) {
|
||||
return isxdigit(c) ? _serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_HEX_MASK : -1;
|
||||
}
|
||||
|
||||
@ -302,24 +302,24 @@ const char *strnchr(const char *s, size_t n, char c);
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
|
||||
__SERVAL_DNA_STR_INLINE ssize_t str_index_dfl(const char *s, char c, ssize_t dfl)
|
||||
__SERVAL_DNA__STR_INLINE ssize_t str_index_dfl(const char *s, char c, ssize_t dfl)
|
||||
{
|
||||
const char *r = strchr(s, c);
|
||||
return r ? r - s : dfl;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE ssize_t str_rindex_dfl(const char *s, char c, ssize_t dfl)
|
||||
__SERVAL_DNA__STR_INLINE ssize_t str_rindex_dfl(const char *s, char c, ssize_t dfl)
|
||||
{
|
||||
const char *r = strrchr(s, c);
|
||||
return r ? r - s : dfl;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE ssize_t str_index(const char *s, char c)
|
||||
__SERVAL_DNA__STR_INLINE ssize_t str_index(const char *s, char c)
|
||||
{
|
||||
return str_index_dfl(s, c, -1);
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE ssize_t str_rindex(const char *s, char c)
|
||||
__SERVAL_DNA__STR_INLINE ssize_t str_rindex(const char *s, char c)
|
||||
{
|
||||
return str_rindex_dfl(s, c, -1);
|
||||
}
|
||||
@ -447,15 +447,15 @@ int str_to_uint64_interval_ms(const char *str, int64_t *result, const char **aft
|
||||
*/
|
||||
int str_is_uri(const char *uri);
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_uri_char_scheme(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_uri_char_scheme(char c) {
|
||||
return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_SCHEME) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_uri_char_unreserved(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_uri_char_unreserved(char c) {
|
||||
return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_UNRESERVED) != 0;
|
||||
}
|
||||
|
||||
__SERVAL_DNA_STR_INLINE int is_uri_char_reserved(char c) {
|
||||
__SERVAL_DNA__STR_INLINE int is_uri_char_reserved(char c) {
|
||||
return (_serval_ctype_1[(unsigned char) c] & _SERVAL_CTYPE_1_URI_RESERVED) != 0;
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ __SERVAL_DNA_STR_INLINE int is_uri_char_reserved(char c) {
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
__SERVAL_DNA_STR_INLINE int str_is_uri_scheme(const char *scheme)
|
||||
__SERVAL_DNA__STR_INLINE int str_is_uri_scheme(const char *scheme)
|
||||
{
|
||||
if (!isalpha(*scheme++))
|
||||
return 0;
|
||||
@ -530,4 +530,4 @@ int str_uri_authority_port(const char *auth, uint16_t *portp);
|
||||
|
||||
int parse_argv(char *cmdline, char delim, char **argv, int max_argv);
|
||||
|
||||
#endif // __SERVAL_DNA_STR_H__
|
||||
#endif // __SERVAL_DNA__STR_H__
|
||||
|
2
uuid.c
2
uuid.c
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define __SERVALDNA_UUID_H_INLINE
|
||||
#define __SERVAL_DNA__UUID_H_INLINE
|
||||
#include "uuid.h"
|
||||
#include "os.h"
|
||||
#include "str.h"
|
||||
|
16
uuid.h
16
uuid.h
@ -17,19 +17,19 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALDNA_UUID_H
|
||||
#define __SERVALDNA_UUID_H
|
||||
#ifndef __SERVAL_DNA__UUID_H
|
||||
#define __SERVAL_DNA__UUID_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <alloca.h>
|
||||
#include <string.h>
|
||||
#include "strbuf.h"
|
||||
|
||||
#ifndef __SERVALDNA_UUID_H_INLINE
|
||||
#ifndef __SERVAL_DNA__UUID_H_INLINE
|
||||
# if __GNUC__ && !__GNUC_STDC_INLINE__
|
||||
# define __SERVALDNA_UUID_H_INLINE extern inline
|
||||
# define __SERVAL_DNA__UUID_H_INLINE extern inline
|
||||
# else
|
||||
# define __SERVALDNA_UUID_H_INLINE inline
|
||||
# define __SERVAL_DNA__UUID_H_INLINE inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -74,11 +74,11 @@ enum uuid_version {
|
||||
UUID_VERSION_NAME_SHA1 = 5
|
||||
};
|
||||
|
||||
__SERVALDNA_UUID_H_INLINE int cmp_uuid_t(const uuid_t *a, const uuid_t *b) {
|
||||
__SERVAL_DNA__UUID_H_INLINE int cmp_uuid_t(const uuid_t *a, const uuid_t *b) {
|
||||
return memcmp(a->u.binary, b->u.binary, sizeof a->u.binary);
|
||||
}
|
||||
|
||||
__SERVALDNA_UUID_H_INLINE int uuid_is_valid(const uuid_t *any_uuid) {
|
||||
__SERVAL_DNA__UUID_H_INLINE int uuid_is_valid(const uuid_t *any_uuid) {
|
||||
return (any_uuid->u.record.clock_seq_hi_and_reserved & 0xc0) == 0x80;
|
||||
}
|
||||
|
||||
@ -125,4 +125,4 @@ strbuf strbuf_uuid(strbuf, const uuid_t *valid_uuid);
|
||||
*/
|
||||
int str_to_uuid(const char *str, uuid_t *result, const char **afterp);
|
||||
|
||||
#endif //__SERVALDNA_OS_H
|
||||
#endif //__SERVAL_DNA__OS_H
|
||||
|
@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SERVALD_XPRINTF_H
|
||||
#define __SERVALD_XPRINTF_H
|
||||
#ifndef __SERVAL_DNA__XPRINTF_H
|
||||
#define __SERVAL_DNA__XPRINTF_H
|
||||
|
||||
/* Generalised (extensible) printf framework.
|
||||
*
|
||||
@ -107,4 +107,4 @@ CONTEXT_VPRINTF _cx_vprintf_mallocbuf;
|
||||
#define XPRINTF_STRBUF(SB) _XPRINTF(_cx_vprintf_strbuf,(SB))
|
||||
CONTEXT_VPRINTF _cx_vprintf_strbuf;
|
||||
|
||||
#endif // __SERVALD_XPRINTF_H
|
||||
#endif // __SERVAL_DNA__XPRINTF_H
|
||||
|
Loading…
Reference in New Issue
Block a user