1 // Copyright (C) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 use std::ffi::{c_char, c_int, c_longlong, c_uint, c_ulonglong, c_void, CString};
15
16 use crate::{EventType, QueryArg, QueryRule, WatchRule};
17
18 /// Length limit for event domain definition.
19 const MAX_LENGTH_OF_EVENT_DOMAIN: usize = 17;
20
21 /// Length limit for event name definition.
22 const MAX_LENGTH_OF_EVENT_NAME: usize = 33;
23
24 /// Length limit for event tag definition.
25 const MAX_LENGTH_OF_EVENT_TAG: usize = 85;
26
27 /// Length limit for timezone definition.
28 const MAX_LENGTH_OF_TIME_ZONE: usize = 6;
29
30 /// Length limit for event list.
31 const MAX_NUMBER_OF_EVENT_LIST: usize = 10;
32
33 /// Length limit for event list definition.
34 const MAX_EVENT_LIST_LEN: usize = 339;
35
36 /// This type represent to HiSysEventWatchRule defined in C.
37 #[repr(C)]
38 #[derive(Copy, Clone)]
39 struct HiSysEventWatchRule {
40 /// The domain of the event.
41 pub domain: [u8; MAX_LENGTH_OF_EVENT_DOMAIN],
42
43 /// The name of the event.
44 pub name: [u8; MAX_LENGTH_OF_EVENT_NAME],
45
46 /// The tag of the event.
47 pub tag: [u8; MAX_LENGTH_OF_EVENT_TAG],
48
49 /// The rule of match system event.
50 pub rule_type: c_int,
51
52 /// The type of match system event.
53 pub event_type: c_int,
54 }
55
56 /// This type represent to HiSysEventQueryArg defined in C.
57 #[repr(C)]
58 #[derive(Copy, Clone)]
59 struct HiSysEventQueryArg {
60 /// Begin time.
61 pub begin_time: c_longlong,
62
63 /// End time.
64 pub end_time: c_longlong,
65
66 /// Max number of receive system event.
67 pub max_events: c_int,
68 }
69
70 /// This type represent to HiSysEventQueryRuleWrapper defined in C.
71 #[repr(C)]
72 #[derive(Copy, Clone)]
73 struct HiSysEventQueryRuleWrapper {
74 // The domain of the event.
75 pub domain: [u8; MAX_LENGTH_OF_EVENT_DOMAIN],
76
77 /// List of event name.
78 pub event_list: [u8; MAX_EVENT_LIST_LEN],
79
80 /// Size of event name list.
81 pub event_list_size: c_uint,
82
83 /// extra condition for event query.
84 pub condition: *const c_char,
85 }
86
87 /// This type represent to HiSysEventRecord defined in C.
88 #[repr(C)]
89 #[derive(Copy, Clone)]
90 pub struct HiSysEventRecord {
91 /// Domain.
92 domain: [u8; MAX_LENGTH_OF_EVENT_DOMAIN],
93
94 /// Event name.
95 event_name: [u8; MAX_LENGTH_OF_EVENT_NAME],
96
97 /// Event type.
98 event_type: c_int,
99
100 /// Timestamp.
101 time: c_ulonglong,
102
103 /// Timezone.
104 tz: [u8; MAX_LENGTH_OF_TIME_ZONE],
105
106 /// Process id.
107 pid: c_longlong,
108
109 /// Thread id.
110 tid: c_longlong,
111
112 /// User id.
113 uid: c_longlong,
114
115 /// Trace id.
116 trace_id: c_ulonglong,
117
118 /// Span id.
119 spand_id: c_ulonglong,
120
121 /// Parent span id.
122 pspan_id: c_ulonglong,
123
124 /// Trace flag.
125 trace_flag: c_int,
126
127 /// Level.
128 level: *const c_char,
129
130 /// Tag.
131 tag: *const c_char,
132
133 /// Event content.
134 json_str: *const c_char,
135 }
136
137 impl HiSysEventRecord {
138 /// Get domain name
get_domain(&self) -> String139 pub fn get_domain(&self) -> String {
140 std::str::from_utf8(&self.domain)
141 .expect("need valid domain array")
142 .trim_end_matches(char::from(0))
143 .to_string()
144 }
145
146 /// Get event name
get_event_name(&self) -> String147 pub fn get_event_name(&self) -> String {
148 std::str::from_utf8(&self.event_name)
149 .expect("need valid event name array")
150 .trim_end_matches(char::from(0))
151 .to_string()
152 }
153
154 /// Get event name
get_event_type(&self) -> EventType155 pub fn get_event_type(&self) -> EventType {
156 match self.event_type {
157 1 => EventType::Fault,
158 2 => EventType::Statistic,
159 3 => EventType::Security,
160 4 => EventType::Behavior,
161 _ => EventType::Fault,
162 }
163 }
164
165 /// Get time
get_time(&self) -> u64166 pub fn get_time(&self) -> u64 {
167 self.time
168 }
169
170 /// Get time zone
get_time_zone(&self) -> String171 pub fn get_time_zone(&self) -> String {
172 std::str::from_utf8(&self.tz)
173 .expect("need valid time zone array")
174 .trim_end_matches(char::from(0))
175 .to_string()
176 }
177
178 /// Get process id
get_pid(&self) -> i64179 pub fn get_pid(&self) -> i64 {
180 self.pid
181 }
182
183 /// Get thread id
get_tid(&self) -> i64184 pub fn get_tid(&self) -> i64 {
185 self.tid
186 }
187
188 /// Get user id
get_uid(&self) -> i64189 pub fn get_uid(&self) -> i64 {
190 self.uid
191 }
192
193 /// Get trace id
get_trace_id(&self) -> u64194 pub fn get_trace_id(&self) -> u64 {
195 self.trace_id
196 }
197
198 /// Get span id
get_span_id(&self) -> u64199 pub fn get_span_id(&self) -> u64 {
200 self.spand_id
201 }
202
203 /// Get parent span id
get_parent_span_id(&self) -> u64204 pub fn get_parent_span_id(&self) -> u64 {
205 self.pspan_id
206 }
207
208 /// Get trace flag
get_trace_flag(&self) -> i32209 pub fn get_trace_flag(&self) -> i32 {
210 self.trace_flag
211 }
212
213 /// Get level
get_level(&self) -> String214 pub fn get_level(&self) -> String {
215 let level_arr = unsafe { std::ffi::CString::from_raw(self.level as *mut std::ffi::c_char) };
216 std::str::from_utf8(level_arr.to_bytes())
217 .expect("need valid level pointer")
218 .trim_end_matches(char::from(0))
219 .to_owned()
220 }
221
222 /// Get tag
get_tag(&self) -> String223 pub fn get_tag(&self) -> String {
224 let tag_arr = unsafe { std::ffi::CString::from_raw(self.tag as *mut std::ffi::c_char) };
225 let tag = std::str::from_utf8(tag_arr.to_bytes())
226 .expect("need valid tag pointer")
227 .trim_end_matches(char::from(0));
228 String::from(tag)
229 }
230
231 /// Get json string
get_json_str(&self) -> String232 pub fn get_json_str(&self) -> String {
233 let json_str_arr =
234 unsafe { std::ffi::CString::from_raw(self.json_str as *mut std::ffi::c_char) };
235 let json_str = std::str::from_utf8(json_str_arr.to_bytes())
236 .expect("need valid json str pointer")
237 .trim_end_matches(char::from(0));
238 String::from(json_str)
239 }
240 }
241
242 /// Callback for handling query result, the query result will be send in several
243 /// times.
244 pub type OnQuery =
245 unsafe extern "C" fn(callback: *mut c_void, records: *const HiSysEventRecord, size: c_uint);
246
247 /// Callback when event quering finish.
248 pub type OnComplete = unsafe extern "C" fn(callback: *mut c_void, reason: c_int, total: c_int);
249
250 /// This type represent a rust HiSysEventRustQuerierC which like C++
251 /// HiSysEventRustQuerierC.
252 #[repr(C)]
253 struct HiSysEventRustQuerierC {
254 pub on_query_cb: *mut c_void,
255 pub on_query_wrapper_cb: OnQuery,
256 pub on_complete_cb: *mut c_void,
257 pub on_complete_wrapper_cb: OnComplete,
258 }
259
260 /// This type represent a rust interfaces.
261 #[allow(dead_code)]
262 pub struct Querier {
263 /// Native event querier.
264 native: *mut HiSysEventRustQuerierC,
265
266 /// Customized rust callback on query.
267 on_query_callback: *mut c_void,
268
269 /// Customized rust callback on complete.
270 on_complete_callback: *mut c_void,
271 }
272
273 impl Querier {
274 /// Create a rust HiSysEventRustQuerierC object with callbacks in a querier.
new<F1, F2>(on_query_callback: F1, on_complete_callback: F2) -> Option<Self> where F1: Fn(&[HiSysEventRecord]) + Send + Sync + 'static, F2: Fn(i32, i32) + Send + Sync + 'static,275 pub fn new<F1, F2>(on_query_callback: F1, on_complete_callback: F2) -> Option<Self>
276 where
277 F1: Fn(&[HiSysEventRecord]) + Send + Sync + 'static,
278 F2: Fn(i32, i32) + Send + Sync + 'static,
279 {
280 let on_query_callback = Box::into_raw(Box::new(on_query_callback));
281 let on_complete_callback = Box::into_raw(Box::new(on_complete_callback));
282 let native = unsafe {
283 CreateRustEventQuerier(
284 on_query_callback as *mut c_void,
285 Self::on_query_callback::<F1>,
286 on_complete_callback as *mut c_void,
287 Self::on_complete_callback::<F2>,
288 )
289 };
290 if native.is_null() {
291 None
292 } else {
293 Some(Self {
294 native,
295 on_query_callback: on_query_callback as *mut c_void,
296 on_complete_callback: on_complete_callback as *mut c_void,
297 })
298 }
299 }
300
301 /// Callback for handling query result, the query result will be send in
302 /// several times.
303 ///
304 /// # Safety
305 ///
306 /// The callback parameter will be kept valid during native
307 /// HiSysEventRustQuerierC object lifetime.
on_query_callback<F>( callback: *mut c_void, records: *const HiSysEventRecord, size: c_uint, ) where F: Fn(&[HiSysEventRecord]) + Send + Sync + 'static,308 unsafe extern "C" fn on_query_callback<F>(
309 callback: *mut c_void,
310 records: *const HiSysEventRecord,
311 size: c_uint,
312 ) where
313 F: Fn(&[HiSysEventRecord]) + Send + Sync + 'static,
314 {
315 let mut transalted_records: Vec<HiSysEventRecord> = vec![];
316 for i in 0..size {
317 let record_item =
318 unsafe { GetHiSysEventRecordByIndexWrapper(records, size, i as c_uint) };
319 transalted_records.push(record_item);
320 }
321 let callback = (callback as *const F).as_ref().unwrap();
322 callback(transalted_records.as_slice());
323 }
324
325 /// Callback when event quering finish.
326 ///
327 /// # Safety
328 ///
329 /// The callback parameter will be kept valid during native
330 /// HiSysEventRustQuerierC object lifetime.
on_complete_callback<F>(callback: *mut c_void, reason: c_int, total: c_int) where F: Fn(i32, i32) + Send + Sync + 'static,331 unsafe extern "C" fn on_complete_callback<F>(callback: *mut c_void, reason: c_int, total: c_int)
332 where
333 F: Fn(i32, i32) + Send + Sync + 'static,
334 {
335 let callback = (callback as *const F).as_ref().unwrap();
336 callback(reason, total);
337 }
338
339 /// free memories allocated for Querier
try_to_recycle(&self)340 pub fn try_to_recycle(&self) {
341 unsafe { RecycleRustEventQuerier(self.as_raw()) }
342 }
343 }
344
345 /// Implement trait AsRawPtr for Querier
346 ///
347 /// # Safety
348 ///
349 /// A `Querier` is always constructed with a valid raw pointer
350 /// to a `HiSysEventRustQuerierC`.
351 unsafe impl AsRawPtr<HiSysEventRustQuerierC> for Querier {
as_raw(&self) -> *const HiSysEventRustQuerierC352 fn as_raw(&self) -> *const HiSysEventRustQuerierC {
353 self.native
354 }
355
as_mut_raw(&mut self) -> *mut HiSysEventRustQuerierC356 fn as_mut_raw(&mut self) -> *mut HiSysEventRustQuerierC {
357 self.native
358 }
359 }
360
361 /// Query system event.
query(query_arg: &QueryArg, query_rules: &[QueryRule], querier: &Querier) -> i32362 pub(crate) fn query(query_arg: &QueryArg, query_rules: &[QueryRule], querier: &Querier) -> i32 {
363 let query_arg_wrapper = HiSysEventQueryArg {
364 begin_time: query_arg.begin_time as c_longlong,
365 end_time: query_arg.end_time as c_longlong,
366 max_events: query_arg.max_events as c_int,
367 };
368 let mut query_rules_wrapper: Vec<HiSysEventQueryRuleWrapper> = vec![];
369 for i in 0..query_rules.len() {
370 let condition_wrapper =
371 CString::new(query_rules[i].condition).expect("Need a condition for query.");
372 query_rules_wrapper.push(HiSysEventQueryRuleWrapper {
373 domain: [0; MAX_LENGTH_OF_EVENT_DOMAIN],
374 event_list: [0; MAX_EVENT_LIST_LEN],
375 event_list_size: MAX_NUMBER_OF_EVENT_LIST as c_uint,
376 condition: condition_wrapper.as_ptr() as *const c_char,
377 });
378 crate::utils::trans_slice_to_array(
379 query_rules[i].domain,
380 &mut query_rules_wrapper[i].domain,
381 );
382 let src_len = query_rules[i].event_list.len();
383 let dest_len = query_rules_wrapper[i].event_list.len();
384 let total_cnt = if src_len <= dest_len {
385 src_len
386 } else {
387 dest_len
388 };
389 query_rules_wrapper[i].event_list_size = total_cnt as c_uint;
390 let src_str = query_rules[i].event_list.join("|");
391 let src_str = &src_str[..];
392 crate::utils::trans_slice_to_array(src_str, &mut query_rules_wrapper[i].event_list);
393 }
394 // Safty: call C ffi border function, all risks are under control.
395 unsafe {
396 HiSysEventQueryWrapper(
397 &query_arg_wrapper as *const HiSysEventQueryArg,
398 query_rules_wrapper.as_mut_ptr(),
399 query_rules.len() as c_uint,
400 querier.as_raw(),
401 )
402 }
403 }
404
405 /// Callback when receive system event.
406 pub type OnEvent = unsafe extern "C" fn(callback: *mut c_void, record: HiSysEventRecord);
407
408 /// Callback when hisysevent service shutdown.
409 pub type OnServiceDied = unsafe extern "C" fn(callback: *mut c_void);
410
411 /// This type represent a rust HiSysEventWatcher which like C++
412 /// HiSysEventWatcher.
413 #[repr(C)]
414 struct HiSysEventRustWatcherC {
415 pub on_event_cb: *mut c_void,
416 pub on_event_wrapper_cb: OnEvent,
417 pub on_service_died_cb: *mut c_void,
418 pub on_service_died_wrapper_cb: OnServiceDied,
419 }
420
421 /// This type represent a rust interfaces.
422 #[allow(dead_code)]
423 pub struct Watcher {
424 /// Native event listener instance
425 native: *mut HiSysEventRustWatcherC,
426
427 /// Customized rust callback on event
428 on_event_callback: *mut c_void,
429
430 /// Customized rust callback on service died
431 on_service_died_callback: *mut c_void,
432 }
433
434 impl Watcher {
435 /// Create a rust HiSysEventRustWatcherC object with callbacks in a watcher.
new<F1, F2>(on_event_callback: F1, on_service_died_callback: F2) -> Option<Self> where F1: Fn(HiSysEventRecord) + Send + Sync + 'static, F2: Fn() + Send + Sync + 'static,436 pub fn new<F1, F2>(on_event_callback: F1, on_service_died_callback: F2) -> Option<Self>
437 where
438 F1: Fn(HiSysEventRecord) + Send + Sync + 'static,
439 F2: Fn() + Send + Sync + 'static,
440 {
441 let on_event_callback = Box::into_raw(Box::new(on_event_callback));
442 let on_service_died_callback = Box::into_raw(Box::new(on_service_died_callback));
443 let native = unsafe {
444 CreateRustEventWatcher(
445 on_event_callback as *mut c_void,
446 Self::on_event::<F1>,
447 on_service_died_callback as *mut c_void,
448 Self::on_service_died::<F2>,
449 )
450 };
451 if native.is_null() {
452 None
453 } else {
454 Some(Self {
455 native,
456 on_event_callback: on_event_callback as *mut c_void,
457 on_service_died_callback: on_service_died_callback as *mut c_void,
458 })
459 }
460 }
461
462 /// Callback when receive system event.
463 ///
464 /// # Safety
465 ///
466 /// The callback parameter will be kept valid during native
467 /// HiSysEventRustWatcherC object lifetime.
on_event<F>(callback: *mut c_void, record: HiSysEventRecord) where F: Fn(HiSysEventRecord) + Send + Sync + 'static,468 unsafe extern "C" fn on_event<F>(callback: *mut c_void, record: HiSysEventRecord)
469 where
470 F: Fn(HiSysEventRecord) + Send + Sync + 'static,
471 {
472 let callback = (callback as *const F).as_ref().unwrap();
473 callback(record);
474 }
475
476 /// Callback when hisysevent service shutdown.
477 ///
478 /// # Safety
479 ///
480 /// The callback parameter will be kept valid during native
481 /// HiSysEventRustWatcherC object lifetime.
on_service_died<F>(callback: *mut c_void) where F: Fn() + Send + Sync + 'static,482 unsafe extern "C" fn on_service_died<F>(callback: *mut c_void)
483 where
484 F: Fn() + Send + Sync + 'static,
485 {
486 let callback = (callback as *const F).as_ref().unwrap();
487 callback();
488 }
489
490 /// free memories allocated for Watcher
try_to_recycle(&self)491 pub fn try_to_recycle(&self) {
492 unsafe { RecycleRustEventWatcher(self.as_raw()) }
493 }
494 }
495
496 /// Implement trait AsRawPtr for Watcher
497 ///
498 /// # Safety
499 ///
500 /// A `Watcher` is always constructed with a valid raw pointer
501 /// to a `HiSysEventRustWatcherC`.
502 unsafe impl AsRawPtr<HiSysEventRustWatcherC> for Watcher {
as_raw(&self) -> *const HiSysEventRustWatcherC503 fn as_raw(&self) -> *const HiSysEventRustWatcherC {
504 self.native
505 }
506
as_mut_raw(&mut self) -> *mut HiSysEventRustWatcherC507 fn as_mut_raw(&mut self) -> *mut HiSysEventRustWatcherC {
508 self.native
509 }
510 }
511
512 /// Add watcher to watch system event.
add_watcher(watcher: &Watcher, watch_rules: &[WatchRule]) -> i32513 pub(crate) fn add_watcher(watcher: &Watcher, watch_rules: &[WatchRule]) -> i32 {
514 let mut watch_rules_wrapper: Vec<HiSysEventWatchRule> = vec![];
515 for i in 0..watch_rules.len() {
516 watch_rules_wrapper.push(HiSysEventWatchRule {
517 domain: [0; MAX_LENGTH_OF_EVENT_DOMAIN],
518 name: [0; MAX_LENGTH_OF_EVENT_NAME],
519 tag: [0; MAX_LENGTH_OF_EVENT_TAG],
520 rule_type: 0,
521 event_type: 0,
522 });
523 crate::utils::trans_slice_to_array(
524 watch_rules[i].domain,
525 &mut watch_rules_wrapper[i].domain,
526 );
527 crate::utils::trans_slice_to_array(watch_rules[i].name, &mut watch_rules_wrapper[i].name);
528 crate::utils::trans_slice_to_array(watch_rules[i].tag, &mut watch_rules_wrapper[i].tag);
529 watch_rules_wrapper[i].rule_type = watch_rules[i].rule_type as i32 as c_int;
530 watch_rules_wrapper[i].event_type = watch_rules[i].event_type as i32 as c_int;
531 }
532 // Safty: call C ffi border function, all risks are under control.
533 unsafe {
534 HiSysEventAddWatcherWrapper(
535 watcher.as_raw(),
536 watch_rules_wrapper.as_mut_ptr(),
537 watch_rules.len() as c_uint,
538 )
539 }
540 }
541
542 /// Remove watcher.
remove_watcher(watcher: &Watcher) -> i32543 pub(crate) fn remove_watcher(watcher: &Watcher) -> i32 {
544 // Safty: call C ffi border function, all risks are under control.
545 unsafe { HiSysEventRemoveWatcherWrapper(watcher.as_raw()) }
546 }
547
548 /// Trait for transparent Rust wrappers around native raw pointer types.
549 ///
550 /// # Safety
551 ///
552 /// The pointer return by this trait's methods should be immediately passed to
553 /// native and not stored by Rust. The pointer is valid only as long as the
554 /// underlying native object is alive, so users must be careful to take this
555 /// into account, as Rust cannot enforce this.
556 ///
557 /// For this trait to be a correct implementation, `T` must be a valid native
558 /// type. Since we cannot constrain this via the type system, this trait is
559 /// marked as unsafe.
560 unsafe trait AsRawPtr<T> {
561 /// Return a pointer to the native version of `self`
as_raw(&self) -> *const T562 fn as_raw(&self) -> *const T;
563
564 /// Return a mutable pointer to the native version of `self`
as_mut_raw(&mut self) -> *mut T565 fn as_mut_raw(&mut self) -> *mut T;
566 }
567
568 extern "C" {
569 /// ffi border function.
HiSysEventAddWatcherWrapper( watcher: *const HiSysEventRustWatcherC, rules: *const HiSysEventWatchRule, rule_size: c_uint, ) -> c_int570 fn HiSysEventAddWatcherWrapper(
571 watcher: *const HiSysEventRustWatcherC,
572 rules: *const HiSysEventWatchRule,
573 rule_size: c_uint,
574 ) -> c_int;
575
576 /// ffi border function.
HiSysEventRemoveWatcherWrapper(watcher: *const HiSysEventRustWatcherC) -> c_int577 fn HiSysEventRemoveWatcherWrapper(watcher: *const HiSysEventRustWatcherC) -> c_int;
578
579 /// ffi border function.
HiSysEventQueryWrapper( query_arg: *const HiSysEventQueryArg, rules: *const HiSysEventQueryRuleWrapper, rule_size: c_uint, querier: *const HiSysEventRustQuerierC, ) -> c_int580 fn HiSysEventQueryWrapper(
581 query_arg: *const HiSysEventQueryArg,
582 rules: *const HiSysEventQueryRuleWrapper,
583 rule_size: c_uint,
584 querier: *const HiSysEventRustQuerierC,
585 ) -> c_int;
586
587 /// ffi border function.
GetHiSysEventRecordByIndexWrapper( records: *const HiSysEventRecord, total: c_uint, index: c_uint, ) -> HiSysEventRecord588 fn GetHiSysEventRecordByIndexWrapper(
589 records: *const HiSysEventRecord,
590 total: c_uint,
591 index: c_uint,
592 ) -> HiSysEventRecord;
593
594 /// ffi border function.
CreateRustEventWatcher( on_event_callback: *const c_void, on_event_wrapper_callback: OnEvent, on_service_died_callback: *const c_void, on_service_died_wrapper_callback: OnServiceDied, ) -> *mut HiSysEventRustWatcherC595 fn CreateRustEventWatcher(
596 on_event_callback: *const c_void,
597 on_event_wrapper_callback: OnEvent,
598 on_service_died_callback: *const c_void,
599 on_service_died_wrapper_callback: OnServiceDied,
600 ) -> *mut HiSysEventRustWatcherC;
601
602 /// ffi border function.
RecycleRustEventWatcher(watcher: *const HiSysEventRustWatcherC)603 fn RecycleRustEventWatcher(watcher: *const HiSysEventRustWatcherC);
604
605 /// ffi border function.
CreateRustEventQuerier( on_query_callback: *const c_void, on_query_wrapper_callback: OnQuery, on_complete_callback: *const c_void, on_complete_wrapper_callback: OnComplete, ) -> *mut HiSysEventRustQuerierC606 fn CreateRustEventQuerier(
607 on_query_callback: *const c_void,
608 on_query_wrapper_callback: OnQuery,
609 on_complete_callback: *const c_void,
610 on_complete_wrapper_callback: OnComplete,
611 ) -> *mut HiSysEventRustQuerierC;
612
613 /// ffi border function.
RecycleRustEventQuerier(querier: *const HiSysEventRustQuerierC)614 fn RecycleRustEventQuerier(querier: *const HiSysEventRustQuerierC);
615 }
616