-
Notifications
You must be signed in to change notification settings - Fork 92
/
login.h
51 lines (44 loc) · 1023 Bytes
/
login.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-3.0-only
/*
* Copyright (c) 2023 Dengfeng Liu <[email protected]>
*/
#ifndef XFRPC_LOGIN_H_
#define XFRPC_LOGIN_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <time.h>
#include "uthash.h"
// Login configuration structure
typedef struct login {
// Version information
char *version;
// System information
char *hostname;
char *os;
char *arch;
// User credentials
char *user;
char *privilege_key;
// Session information
time_t timestamp;
char *run_id;
char *metas;
int pool_count;
// Login status
int logged; // 0: not logged in, 1: logged in
} login_t;
// Login response structure
typedef struct login_resp {
char *version;
char *run_id;
char *error;
} login_resp_t;
// Function declarations
void init_login(void);
char *get_run_id(void);
login_t *get_common_login_config(void);
int is_logged(void);
int login_resp_check(login_resp_t *lr);
#endif /* XFRPC_LOGIN_H_ */