mz: Check device argument by ifindex instead of name prefix
[netsniff-ng-new.git] / curvetun_mgmt_users.h
blobff9d6016764a972b27257b91d9e10c181f94adae
1 #ifndef CT_USERMGMT_H
2 #define CT_USERMGMT_H
4 #include <stdint.h>
6 #include "curve.h"
7 #include "crypto_hash_sha512.h"
9 enum is_user_enum {
10 USERNAMES_OK = 0, /* Usernames match, valid 'token' */
11 USERNAMES_NE, /* Usernames do not match */
12 USERNAMES_TS, /* Usernames match, but 'token' invalid,
13 Drop connection here */
14 USERNAMES_ERR,
17 struct username_struct {
18 uint32_t salt;
19 uint8_t hash[crypto_hash_sha512_BYTES];
22 extern int username_msg(char *username, size_t len, char *dst, size_t dlen);
23 extern enum is_user_enum username_msg_is_user(char *src, size_t slen,
24 char *username, size_t len);
25 extern void parse_userfile_and_generate_user_store_or_die(char *homedir);
26 extern void dump_user_store(void);
27 extern void destroy_user_store(void);
29 extern int get_user_by_socket(int sock, struct curve25519_proto **proto);
30 extern int get_user_by_sockaddr(struct sockaddr_storage *sa, size_t sa_len,
31 struct curve25519_proto **proto);
32 extern int try_register_user_by_socket(struct curve25519_struct *c,
33 char *src, size_t slen, int sock,
34 int log);
35 extern int try_register_user_by_sockaddr(struct curve25519_struct *c,
36 char *src, size_t slen,
37 struct sockaddr_storage *sa,
38 size_t sa_len, int log);
39 extern void remove_user_by_socket(int sock);
40 extern void remove_user_by_sockaddr(struct sockaddr_storage *sa,
41 size_t sa_len);
43 #endif /* CT_USERMGMT_H */