summaryrefslogtreecommitdiff
path: root/src/greetd.h
blob: 3901d85aeeafbf19c8585d133ebef71e2df2345f (plain)
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
#ifndef GREETD_H
#define GREETD_H

#include <json-c/json_object.h>

enum greetd_request_type {
	GREETD_REQUEST_CREATE_SESSION,
	GREETD_REQUEST_POST_AUTH_MESSAGE_RESPONSE,
	GREETD_REQUEST_START_SESSION,
	GREETD_REQUEST_CANCEL_SESSION
};

enum greetd_response_type {
	GREETD_RESPONSE_INVALID,
	GREETD_RESPONSE_SUCCESS,
	GREETD_RESPONSE_ERROR,
	GREETD_RESPONSE_AUTH_MESSAGE
};

enum greetd_auth_message_type {
	GREETD_AUTH_MESSAGE_INVALID,
	GREETD_AUTH_MESSAGE_VISIBLE,
	GREETD_AUTH_MESSAGE_SECRET,
	GREETD_AUTH_MESSAGE_INFO,
	GREETD_AUTH_MESSAGE_ERROR
};

enum greetd_error_type {
	GREETD_ERROR_INVALID,
	GREETD_ERROR_AUTH_ERROR,
	GREETD_ERROR_ERROR
};

[[nodiscard]] struct json_object *greetd_create_session(const char *username);
[[nodiscard]] struct json_object *greetd_post_auth_message_response(const char *response);
[[nodiscard]] struct json_object *greetd_start_session(const char *command);
[[nodiscard]] struct json_object *greetd_cancel_session(void);

enum greetd_response_type greetd_parse_response_type(struct json_object *response);
enum greetd_auth_message_type greetd_parse_auth_message_type(struct json_object *response);
enum greetd_error_type greetd_parse_error_type(struct json_object *response);

#endif /* GREETD_H */