#include "subnet.h"
#include "tincctl.h"
#include "info.h"
+#include "utils.h"
#include "xalloc.h"
void logger(int level, int priority, const char *format, ...) {
static splay_tree_t *past_request_tree;
-bool check_id(const char *id) {
- if(!id || !*id)
- return false;
-
- for(; *id; id++)
- if(!isalnum(*id) && *id != '_')
- return false;
-
- return true;
-}
-
/* Generic request routines - takes care of logging and error
detection as well */
extern bool send_request(struct connection_t *, const char *, ...) __attribute__ ((__format__(printf, 2, 3)));
extern void forward_request(struct connection_t *, const char *);
extern bool receive_request(struct connection_t *, const char *);
-extern bool check_id(const char *);
extern void init_requests(void);
extern void exit_requests(void);
return 0;
}
-bool check_id(const char *name) {
- if(!name || !*name)
- return false;
-
- for(int i = 0; i < strlen(name); i++) {
- if(!isalnum(name[i]) && name[i] != '_')
- return false;
- }
-
- return true;
-}
-
static bool try_bind(int port) {
struct addrinfo *ai = NULL;
struct addrinfo hint = {
return value;
}
+bool check_id(const char *id) {
+ if(!id || !*id)
+ return false;
+
+ for(; *id; id++)
+ if(!isalnum(*id) && *id != '_')
+ return false;
+
+ return true;
+}
+
char *replace_name(const char *name) {
char *ret_name;
extern unsigned int bitfield_to_int(const void *bitfield, size_t size);
+extern bool check_id(const char *);
char *replace_name(const char *name);
#endif /* __TINC_UTILS_H__ */