2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #ifndef LTTNG_SESSIOND_JUL_H
19 #define LTTNG_SESSIOND_JUL_H
24 #include <common/hashtable/hashtable.h>
25 #include <lttng/lttng.h>
28 * Hash table that contains the JUL app created upon registration indexed by
31 struct lttng_ht
*jul_apps_ht_by_sock
;
35 enum lttng_loglevel_jul loglevel
;
39 * Registration message payload from a JUL application. The PID is used to find
40 * back the corresponding UST app object so both socket can be linked.
42 struct jul_register_msg
{
47 * JUL application object created after a successful registration. This
48 * object is linked to its associated UST app by their PID through hash
53 * PID sent during registration of a JUL application.
58 * JUL TCP socket that was created upon registration.
60 struct lttcomm_sock
*sock
;
62 /* Initialized with the JUL sock value. */
63 struct lttng_ht_node_ulong node
;
67 * Java Util Logging event representation.
71 * Name of the event which is directly mapped to a Logger object name in
74 char name
[LTTNG_SYMBOL_NAME_LEN
];
75 enum lttng_loglevel_jul loglevel
;
76 enum lttng_loglevel_type loglevel_type
;
79 * Tells if the event is enabled or not on the JUL Agent.
81 unsigned int enabled
:1;
84 * Hash table nodes of the JUL domain. Indexed by name string.
86 struct lttng_ht_node_str node
;
88 /* Bytecode filter associated with the event . NULL if none. */
89 struct lttng_filter_bytecode
*filter
;
93 * Top level data structure in a UST session containing JUL event name created
98 * This indicates if that domain is being used meaning if at least one
99 * event has been at some point in time added to it. This is used so when
100 * listing domains for a session, we can tell or not if the JUL is actually
103 unsigned int being_used
:1;
105 * Contains JUL event indexed by name.
107 struct lttng_ht
*events
;
110 /* Initialize JUL domain subsystem. */
113 /* Initialize an already allocated JUL domain. */
114 int jul_init_domain(struct jul_domain
*dom
);
115 void jul_destroy_domain(struct jul_domain
*dom
);
118 struct jul_event
*jul_create_event(const char *name
,
119 struct lttng_filter_bytecode
*filter
);
120 void jul_add_event(struct jul_event
*event
, struct jul_domain
*dom
);
121 struct jul_event
*jul_find_event(const char *name
,
122 enum lttng_loglevel_jul loglevel
, struct jul_domain
*dom
);
123 struct jul_event
*jul_find_event_by_name(const char *name
,
124 struct jul_domain
*dom
);
125 void jul_delete_event(struct jul_event
*event
, struct jul_domain
*dom
);
126 void jul_destroy_event(struct jul_event
*event
);
129 struct jul_app
*jul_create_app(pid_t pid
, struct lttcomm_sock
*sock
);
130 void jul_add_app(struct jul_app
*app
);
131 void jul_delete_app(struct jul_app
*app
);
132 struct jul_app
*jul_find_app_by_sock(int sock
);
133 void jul_destroy_app(struct jul_app
*app
);
134 int jul_send_registration_done(struct jul_app
*app
);
137 int jul_enable_event(struct jul_event
*event
);
138 int jul_disable_event(struct jul_event
*event
);
139 void jul_update(struct jul_domain
*domain
, int sock
);
140 int jul_list_events(struct lttng_event
**events
);
142 #endif /* LTTNG_SESSIOND_JUL_H */