2 common routines for audit logging
4 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2018
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _AUDIT_LOGGING_H_
20 #define _AUDIT_LOGGING_H_
22 #include "lib/messaging/irpc.h"
23 #include "lib/tsocket/tsocket.h"
24 #include "lib/util/attr.h"
26 _WARN_UNUSED_RESULT_ char *audit_get_timestamp(TALLOC_CTX *frame);
27 void audit_log_human_text(const char *prefix,
35 * Wrapper for jannson JSON object
42 extern const struct json_object json_empty_object;
46 void audit_log_json(struct json_object *message,
49 void audit_message_send(struct imessaging_context *msg_ctx,
50 const char *server_name,
51 uint32_t message_type,
52 struct json_object *message);
53 _WARN_UNUSED_RESULT_ struct json_object json_new_object(void);
54 _WARN_UNUSED_RESULT_ struct json_object json_new_array(void);
55 void json_free(struct json_object *object);
56 void json_assert_is_array(struct json_object *array);
57 _WARN_UNUSED_RESULT_ bool json_is_invalid(const struct json_object *object);
59 _WARN_UNUSED_RESULT_ int json_add_int(struct json_object *object,
62 _WARN_UNUSED_RESULT_ int json_add_bool(struct json_object *object,
65 _WARN_UNUSED_RESULT_ int json_add_string(struct json_object *object,
68 _WARN_UNUSED_RESULT_ int json_add_object(struct json_object *object,
70 struct json_object *value);
71 _WARN_UNUSED_RESULT_ int json_add_stringn(struct json_object *object,
75 _WARN_UNUSED_RESULT_ int json_add_version(struct json_object *object,
78 _WARN_UNUSED_RESULT_ int json_add_timestamp(struct json_object *object);
79 _WARN_UNUSED_RESULT_ int json_add_address(
80 struct json_object *object,
82 const struct tsocket_address *address);
83 _WARN_UNUSED_RESULT_ int json_add_sid(struct json_object *object,
85 const struct dom_sid *sid);
86 _WARN_UNUSED_RESULT_ int json_add_guid(struct json_object *object,
88 const struct GUID *guid);
90 _WARN_UNUSED_RESULT_ struct json_object json_get_array(
91 struct json_object *object, const char *name);
92 _WARN_UNUSED_RESULT_ struct json_object json_get_object(
93 struct json_object *object, const char *name);
94 _WARN_UNUSED_RESULT_ char *json_to_string(TALLOC_CTX *mem_ctx,
95 const struct json_object *object);