zsh: add netsniff-ng zsh auto completion support
[netsniff-ng.git] / ct_usermgmt.h
blobd7caae0c966b4e6febf5b0310c24a75482fe7bfa
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2011 Daniel Borkmann.
4 * Subject to the GPL, version 2.
5 */
7 #ifndef CT_USERMGMT_H
8 #define CT_USERMGMT_H
10 #include <stdint.h>
12 #include "curve.h"
13 #include "crypto_hash_sha512.h"
15 enum is_user_enum {
16 USERNAMES_OK = 0, /* Usernames match, valid 'token' */
17 USERNAMES_NE, /* Usernames do not match */
18 USERNAMES_TS, /* Usernames match, but 'token' invalid,
19 Drop connection here */
20 USERNAMES_ERR,
23 struct username_struct {
24 uint32_t salt;
25 uint8_t hash[crypto_hash_sha512_BYTES];
28 extern int username_msg(char *username, size_t len, char *dst, size_t dlen);
29 extern enum is_user_enum username_msg_is_user(char *src, size_t slen,
30 char *username, size_t len);
31 extern void parse_userfile_and_generate_user_store_or_die(char *homedir);
32 extern void dump_user_store(void);
33 extern void destroy_user_store(void);
35 extern int get_user_by_socket(int sock, struct curve25519_proto **proto);
36 extern int get_user_by_sockaddr(struct sockaddr_storage *sa, size_t sa_len,
37 struct curve25519_proto **proto);
38 extern int try_register_user_by_socket(struct curve25519_struct *c,
39 char *src, size_t slen, int sock,
40 int log);
41 extern int try_register_user_by_sockaddr(struct curve25519_struct *c,
42 char *src, size_t slen,
43 struct sockaddr_storage *sa,
44 size_t sa_len, int log);
45 extern void remove_user_by_socket(int sock);
46 extern void remove_user_by_sockaddr(struct sockaddr_storage *sa,
47 size_t sa_len);
49 #endif /* CT_USERMGMT_H */