-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux.jai
1873 lines (1599 loc) · 64.7 KB
/
linux.jai
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// This file was auto-generated using the following command:
//
// jai generate.jai
//
SENTRY_SDK_NAME :: "sentry.native";
SENTRY_SDK_VERSION :: "0.7.9";
sentry_string_free :: sentry_free;
/**
* Allocates memory with the underlying allocator.
*/
sentry_malloc :: (size: u64) -> *void #foreign libsentry;
/**
* Releases memory allocated from the underlying allocator.
*/
sentry_free :: (ptr: *void) -> void #foreign libsentry;
/**
* Type of a sentry value.
*/
sentry_value_type_t :: enum u32 {
NULL :: 0;
BOOL :: 1;
INT32 :: 2;
DOUBLE :: 3;
STRING :: 4;
LIST :: 5;
OBJECT :: 6;
SENTRY_VALUE_TYPE_NULL :: NULL;
SENTRY_VALUE_TYPE_BOOL :: BOOL;
SENTRY_VALUE_TYPE_INT32 :: INT32;
SENTRY_VALUE_TYPE_DOUBLE :: DOUBLE;
SENTRY_VALUE_TYPE_STRING :: STRING;
SENTRY_VALUE_TYPE_LIST :: LIST;
SENTRY_VALUE_TYPE_OBJECT :: OBJECT;
}
/**
* Represents a sentry protocol value.
*
* The members of this type should never be accessed. They are only here
* so that alignment for the type can be properly determined.
*
* Values must be released with `sentry_value_decref`. This lowers the
* internal refcount by one. If the refcount hits zero it's freed. Some
* values like primitives have no refcount (like null) so operations on
* those are no-ops.
*
* In addition values can be frozen. Some values like primitives are always
* frozen but lists and dicts are not and can be frozen on demand. This
* automatically happens for some shared values in the event payload like
* the module list.
*/
sentry_value_u :: union {
_bits: u64;
_double: float64;
}
sentry_value_t :: sentry_value_u;
/**
* Increments the reference count on the value.
*/
sentry_value_incref :: (value: sentry_value_t) -> void #foreign libsentry;
/**
* Decrements the reference count on the value.
*/
sentry_value_decref :: (value: sentry_value_t) -> void #foreign libsentry;
/**
* Returns the refcount of a value.
*/
sentry_value_refcount :: (value: sentry_value_t) -> u64 #foreign libsentry;
/**
* Freezes a value.
*/
sentry_value_freeze :: (value: sentry_value_t) -> void #foreign libsentry;
/**
* Checks if a value is frozen.
*/
sentry_value_is_frozen :: (value: sentry_value_t) -> s32 #foreign libsentry;
/**
* Creates a null value.
*/
sentry_value_new_null :: () -> sentry_value_t #foreign libsentry;
/**
* Creates a new 32-bit signed integer value.
*/
sentry_value_new_int32 :: (value: s32) -> sentry_value_t #foreign libsentry;
/**
* Creates a new double value.
*/
sentry_value_new_double :: (value: float64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new boolean value.
*/
sentry_value_new_bool :: (value: s32) -> sentry_value_t #foreign libsentry;
/**
* Creates a new null terminated string.
*/
sentry_value_new_string :: (value: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_new_string_n :: (value: *u8, value_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new list value.
*/
sentry_value_new_list :: () -> sentry_value_t #foreign libsentry;
/**
* Creates a new object.
*/
sentry_value_new_object :: () -> sentry_value_t #foreign libsentry;
/**
* Returns the type of the value passed.
*/
sentry_value_get_type :: (value: sentry_value_t) -> sentry_value_type_t #foreign libsentry;
/**
* Sets a key to a value in the map.
*
* This moves the ownership of the value into the map. The caller does not
* have to call `sentry_value_decref` on it.
*/
sentry_value_set_by_key :: (value: sentry_value_t, k: *u8, v: sentry_value_t) -> s32 #foreign libsentry;
sentry_value_set_by_key_n :: (value: sentry_value_t, k: *u8, k_len: u64, v: sentry_value_t) -> s32 #foreign libsentry;
/**
* This removes a value from the map by key.
*/
sentry_value_remove_by_key :: (value: sentry_value_t, k: *u8) -> s32 #foreign libsentry;
sentry_value_remove_by_key_n :: (value: sentry_value_t, k: *u8, k_len: u64) -> s32 #foreign libsentry;
/**
* Appends a value to a list.
*
* This moves the ownership of the value into the list. The caller does not
* have to call `sentry_value_decref` on it.
*/
sentry_value_append :: (value: sentry_value_t, v: sentry_value_t) -> s32 #foreign libsentry;
/**
* Inserts a value into the list at a certain position.
*
* This moves the ownership of the value into the list. The caller does not
* have to call `sentry_value_decref` on it.
*
* If the list is shorter than the given index it's automatically extended
* and filled with `null` values.
*/
sentry_value_set_by_index :: (value: sentry_value_t, index: u64, v: sentry_value_t) -> s32 #foreign libsentry;
/**
* This removes a value from the list by index.
*/
sentry_value_remove_by_index :: (value: sentry_value_t, index: u64) -> s32 #foreign libsentry;
/**
* Looks up a value in a map by key. If missing a null value is returned.
* The returned value is borrowed.
*/
sentry_value_get_by_key :: (value: sentry_value_t, k: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_get_by_key_n :: (value: sentry_value_t, k: *u8, k_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Looks up a value in a map by key. If missing a null value is returned.
* The returned value is owned.
*
* If the caller no longer needs the value it must be released with
* `sentry_value_decref`.
*/
sentry_value_get_by_key_owned :: (value: sentry_value_t, k: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_get_by_key_owned_n :: (value: sentry_value_t, k: *u8, k_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Looks up a value in a list by index. If missing a null value is returned.
* The returned value is borrowed.
*/
sentry_value_get_by_index :: (value: sentry_value_t, index: u64) -> sentry_value_t #foreign libsentry;
/**
* Looks up a value in a list by index. If missing a null value is
* returned. The returned value is owned.
*
* If the caller no longer needs the value it must be released with
* `sentry_value_decref`.
*/
sentry_value_get_by_index_owned :: (value: sentry_value_t, index: u64) -> sentry_value_t #foreign libsentry;
/**
* Returns the length of the given map or list.
*
* If an item is not a list or map the return value is 0.
*/
sentry_value_get_length :: (value: sentry_value_t) -> u64 #foreign libsentry;
/**
* Converts a value into a 32bit signed integer.
*/
sentry_value_as_int32 :: (value: sentry_value_t) -> s32 #foreign libsentry;
/**
* Converts a value into a double value.
*/
sentry_value_as_double :: (value: sentry_value_t) -> float64 #foreign libsentry;
/**
* Returns the value as c string.
*/
sentry_value_as_string :: (value: sentry_value_t) -> *u8 #foreign libsentry;
/**
* Returns `true` if the value is boolean true.
*/
sentry_value_is_true :: (value: sentry_value_t) -> s32 #foreign libsentry;
/**
* Returns `true` if the value is null.
*/
sentry_value_is_null :: (value: sentry_value_t) -> s32 #foreign libsentry;
/**
* Serialize a sentry value to JSON.
*
* The string is freshly allocated and must be freed with
* `sentry_string_free`.
*/
sentry_value_to_json :: (value: sentry_value_t) -> *u8 #foreign libsentry;
/**
* Sentry levels for events and breadcrumbs.
*/
sentry_level_e :: enum s32 {
DEBUG :: -1;
INFO :: 0;
WARNING :: 1;
ERROR :: 2;
FATAL :: 3;
SENTRY_LEVEL_DEBUG :: DEBUG;
SENTRY_LEVEL_INFO :: INFO;
SENTRY_LEVEL_WARNING :: WARNING;
SENTRY_LEVEL_ERROR :: ERROR;
SENTRY_LEVEL_FATAL :: FATAL;
}
/**
* Sentry levels for events and breadcrumbs.
*/
sentry_level_t :: sentry_level_e;
/**
* Creates a new empty Event value.
*
* See https://docs.sentry.io/platforms/native/enriching-events/ for how to
* further work with events, and https://develop.sentry.dev/sdk/event-payloads/
* for a detailed overview of the possible properties of an Event.
*/
sentry_value_new_event :: () -> sentry_value_t #foreign libsentry;
/**
* Creates a new Message Event value.
*
* See https://develop.sentry.dev/sdk/event-payloads/message/
*
* `logger` can be NULL to omit the logger value.
*/
sentry_value_new_message_event :: (level: sentry_level_t, logger: *u8, text: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_new_message_event_n :: (level: sentry_level_t, logger: *u8, logger_len: u64, text: *u8, text_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new Breadcrumb with a specific type and message.
*
* See https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/
*
* Either parameter can be NULL in which case no such attributes is created.
*/
sentry_value_new_breadcrumb :: (type: *u8, message: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_new_breadcrumb_n :: (type: *u8, type_len: u64, message: *u8, message_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new Exception value.
*
* This is intended for capturing language-level exception, such as from a
* try-catch block. `type` and `value` here refer to the exception class and
* a possible description.
*
* See https://develop.sentry.dev/sdk/event-payloads/exception/
*
* The returned value needs to be attached to an event via
* `sentry_event_add_exception`.
*/
sentry_value_new_exception :: (type: *u8, value: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_new_exception_n :: (type: *u8, type_len: u64, value: *u8, value_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new Thread value.
*
* See https://develop.sentry.dev/sdk/event-payloads/threads/
*
* The returned value needs to be attached to an event via
* `sentry_event_add_thread`.
*
* `name` can be NULL.
*/
sentry_value_new_thread :: (id: u64, name: *u8) -> sentry_value_t #foreign libsentry;
sentry_value_new_thread_n :: (id: u64, name: *u8, name_len: u64) -> sentry_value_t #foreign libsentry;
/**
* Creates a new Stack Trace conforming to the Stack Trace Interface.
*
* See https://develop.sentry.dev/sdk/event-payloads/stacktrace/
*
* The returned object must be attached to either an exception or thread
* object.
*
* If `ips` is NULL the current stack trace is captured, otherwise `len`
* stack trace instruction pointers are attached to the event.
*/
sentry_value_new_stacktrace :: (ips: **void, len: u64) -> sentry_value_t #foreign libsentry;
/**
* Sets the Stack Trace conforming to the Stack Trace Interface in a value.
*
* The value argument must be either an exception or thread object.
*
* If `ips` is NULL the current stack trace is captured, otherwise `len` stack
* trace instruction pointers are attached to the event.
*/
sentry_value_set_stacktrace :: (value: sentry_value_t, ips: **void, len: u64) -> void #foreign libsentry;
/**
* Adds an Exception to an Event value.
*
* This takes ownership of the `exception`.
*/
sentry_event_add_exception :: (event: sentry_value_t, exception: sentry_value_t) -> void #foreign libsentry;
/**
* Adds a Thread to an Event value.
*
* This takes ownership of the `thread`.
*/
sentry_event_add_thread :: (event: sentry_value_t, thread: sentry_value_t) -> void #foreign libsentry;
/**
* Serialize a sentry value to msgpack.
*
* The string is freshly allocated and must be freed with
* `sentry_string_free`. Since msgpack is not zero terminated
* the size is written to the `size_out` parameter.
*/
sentry_value_to_msgpack :: (value: sentry_value_t, size_out: *u64) -> *u8 #foreign libsentry;
/**
* Adds a stack trace to an event.
*
* The stack trace is added as part of a new thread object.
* This function is **deprecated** in favor of using
* `sentry_value_new_stacktrace` in combination with `sentry_value_new_thread`
* and `sentry_event_add_thread`.
*
* If `ips` is NULL the current stack trace is captured, otherwise `len`
* stack trace instruction pointers are attached to the event.
*/
sentry_event_value_add_stacktrace :: (event: sentry_value_t, ips: **void, len: u64) -> void #foreign libsentry;
/**
* This represents the OS dependent user context in the case of a crash, and can
* be used to manually capture a crash.
*/
sentry_ucontext_s :: struct {
signum: s32;
siginfo: *siginfo_t;
user_context: *ucontext_t;
}
/**
* This represents the OS dependent user context in the case of a crash, and can
* be used to manually capture a crash.
*/
sentry_ucontext_t :: sentry_ucontext_s;
/**
* Unwinds the stack from the given address.
*
* If the address is given in `addr` the stack is unwound form there.
* Otherwise (NULL is passed) the current instruction pointer is used as
* start address.
* Unwinding with a given `addr` is not supported on all platforms.
*
* The stack trace in the form of instruction-addresses, is written to the
* caller allocated `stacktrace_out`, with up to `max_len` frames being written.
* The actual number of unwound stackframes is returned.
*/
sentry_unwind_stack :: (addr: *void, stacktrace_out: **void, max_len: u64) -> u64 #foreign libsentry;
/**
* Unwinds the stack from the given context.
*
* The caller is responsible to construct an appropriate `sentry_ucontext_t`.
* Unwinding from a user context is not supported on all platforms.
*
* The stack trace in the form of instruction-addresses, is written to the
* caller allocated `stacktrace_out`, with up to `max_len` frames being written.
* The actual number of unwound stackframes is returned.
*/
sentry_unwind_stack_from_ucontext :: (uctx: *sentry_ucontext_t, stacktrace_out: **void, max_len: u64) -> u64 #foreign libsentry;
/**
* A UUID
*/
sentry_uuid_s :: struct {
bytes: [16] u8;
}
/**
* A UUID
*/
sentry_uuid_t :: sentry_uuid_s;
/**
* Creates the nil uuid.
*/
sentry_uuid_nil :: () -> sentry_uuid_t #foreign libsentry;
/**
* Creates a new uuid4.
*/
sentry_uuid_new_v4 :: () -> sentry_uuid_t #foreign libsentry;
/**
* Parses a uuid from a string.
*/
sentry_uuid_from_string :: (str: *u8) -> sentry_uuid_t #foreign libsentry;
sentry_uuid_from_string_n :: (str: *u8, str_len: u64) -> sentry_uuid_t #foreign libsentry;
/**
* Creates a uuid from bytes.
*/
sentry_uuid_from_bytes :: (bytes: *[16] u8) -> sentry_uuid_t #foreign libsentry;
/**
* Checks if the uuid is nil.
*/
sentry_uuid_is_nil :: (uuid: *sentry_uuid_t) -> s32 #foreign libsentry;
/**
* Returns the bytes of the uuid.
*/
sentry_uuid_as_bytes :: (uuid: *sentry_uuid_t, bytes: *[16] u8) -> void #foreign libsentry;
/**
* Formats the uuid into a string buffer.
*/
sentry_uuid_as_string :: (uuid: *sentry_uuid_t, str: *[37] u8) -> void #foreign libsentry;
/**
* A Sentry Envelope.
*
* The Envelope is an abstract type which represents a payload being sent to
* sentry. It can contain one or more items, typically an Event.
* See https://develop.sentry.dev/sdk/envelopes/
*/
sentry_envelope_s :: struct {}
sentry_envelope_t :: sentry_envelope_s;
/**
* Frees an envelope.
*/
sentry_envelope_free :: (envelope: *sentry_envelope_t) -> void #foreign libsentry;
/**
* Given an Envelope, returns the embedded Event if there is one.
*
* This returns a borrowed value to the Event in the Envelope.
*/
sentry_envelope_get_event :: (envelope: *sentry_envelope_t) -> sentry_value_t #foreign libsentry;
/**
* Given an Envelope, returns the embedded Transaction if there is one.
*
* This returns a borrowed value to the Transaction in the Envelope.
*/
sentry_envelope_get_transaction :: (envelope: *sentry_envelope_t) -> sentry_value_t #foreign libsentry;
/**
* Serializes the envelope.
*
* The return value needs to be freed with sentry_string_free().
*/
sentry_envelope_serialize :: (envelope: *sentry_envelope_t, size_out: *u64) -> *u8 #foreign libsentry;
/**
* Serializes the envelope into a file.
*
* `path` is assumed to be in platform-specific filesystem path encoding.
*
* Returns 0 on success.
*/
sentry_envelope_write_to_file :: (envelope: *sentry_envelope_t, path: *u8) -> s32 #foreign libsentry;
sentry_envelope_write_to_file_n :: (envelope: *sentry_envelope_t, path: *u8, path_len: u64) -> s32 #foreign libsentry;
/**
* The Sentry Client Options.
*
* See https://docs.sentry.io/platforms/native/configuration/
*/
sentry_options_s :: struct {}
sentry_options_t :: sentry_options_s;
/**
* This represents an interface for user-defined transports.
*
* Transports are responsible for sending envelopes to sentry and are the last
* step in the event pipeline.
*
* Envelopes will be submitted to the transport in a _fire and forget_ fashion,
* and the transport must send those envelopes _in order_.
*
* A transport has the following hooks, all of which
* take the user provided `state` as last parameter. The transport state needs
* to be set with `sentry_transport_set_state` and typically holds handles and
* other information that can be reused across requests.
*
* * `send_func`: This function will take ownership of an envelope, and is
* responsible for freeing it via `sentry_envelope_free`.
* * `startup_func`: This hook will be called by sentry inside of `sentry_init`
* and instructs the transport to initialize itself. Failures will bubble up
* to `sentry_init`.
* * `flush_func`: Instructs the transport to flush its queue.
* This hook receives a millisecond-resolution `timeout` parameter and should
* return `0` if the transport queue is flushed within the timeout.
* * `shutdown_func`: Instructs the transport to flush its queue and shut down.
* This hook receives a millisecond-resolution `timeout` parameter and should
* return `0` if the transport is flushed and shut down successfully.
* In case of a non-zero return value, sentry will log an error, but continue
* with freeing the transport.
* * `free_func`: Frees the transports `state`. This hook might be called even
* though `shutdown_func` returned a failure code previously.
*
* The transport interface might be extended in the future with hooks to flush
* its internal queue without shutting down, and to dump its internal queue to
* disk in case of a hard crash.
*/
sentry_transport_s :: struct {}
sentry_transport_t :: sentry_transport_s;
/**
* Creates a new transport with an initial `send_func`.
*/
sentry_transport_new :: (send_func: #type (envelope: *sentry_envelope_t, state: *void) -> void #c_call) -> *sentry_transport_t #foreign libsentry;
/**
* Sets the transport `state`.
*
* If the state is owned by the transport and needs to be freed, use
* `sentry_transport_set_free_func` to set an appropriate hook.
*/
sentry_transport_set_state :: (transport: *sentry_transport_t, state: *void) -> void #foreign libsentry;
/**
* Sets the transport hook to free the transport `state`.
*/
sentry_transport_set_free_func :: (transport: *sentry_transport_t, free_func: #type (state: *void) -> void #c_call) -> void #foreign libsentry;
/**
* Sets the transport startup hook.
*
* This hook is called from within `sentry_init` and will get a reference to the
* options which can be used to initialize a transports internal state.
* It should return `0` on success. A failure will bubble up to `sentry_init`.
*/
sentry_transport_set_startup_func :: (transport: *sentry_transport_t, startup_func: #type (options: *sentry_options_t, state: *void) -> s32 #c_call) -> void #foreign libsentry;
/**
* Sets the transport flush hook.
*
* This hook will receive a millisecond-resolution timeout.
* It should return `0` if all the pending envelopes are
* sent within the timeout, or `1` if the timeout is hit.
*/
sentry_transport_set_flush_func :: (transport: *sentry_transport_t, flush_func: #type (timeout: u64, state: *void) -> s32 #c_call) -> void #foreign libsentry;
/**
* Sets the transport shutdown hook.
*
* This hook will receive a millisecond-resolution timeout.
* It should return `0` on success in case all the pending envelopes have been
* sent within the timeout, or `1` if the timeout was hit.
*/
sentry_transport_set_shutdown_func :: (transport: *sentry_transport_t, shutdown_func: #type (timeout: u64, state: *void) -> s32 #c_call) -> void #foreign libsentry;
/**
* Generic way to free a transport.
*/
sentry_transport_free :: (transport: *sentry_transport_t) -> void #foreign libsentry;
/**
* Create a new function transport.
*
* It is a convenience function which works with a borrowed `data`, and will
* automatically free the envelope, so the user provided function does not need
* to do that.
*
* This function is *deprecated* and will be removed in a future version.
* It is here for backwards compatibility. Users should migrate to the
* `sentry_transport_new` API.
*/
sentry_new_function_transport :: (func: #type (envelope: *sentry_envelope_t, data: *void) -> void #c_call, data: *void) -> *sentry_transport_t #foreign libsentry;
/**
* This represents an interface for user-defined backends.
*
* Backends are responsible to handle crashes. They are maintained at runtime
* via various life-cycle hooks from the sentry-core.
*
* At this point none of those interfaces are exposed in the API including
* creation and destruction. The main use-case of the backend in the API at this
* point is to disable it via `sentry_options_set_backend` at runtime before it
* is initialized.
*/
sentry_backend_s :: struct {}
sentry_backend_t :: sentry_backend_s;
/**
* The state of user consent.
*/
sentry_user_consent_t :: enum s32 {
UNKNOWN :: -1;
GIVEN :: 1;
REVOKED :: 0;
SENTRY_USER_CONSENT_UNKNOWN :: UNKNOWN;
SENTRY_USER_CONSENT_GIVEN :: GIVEN;
SENTRY_USER_CONSENT_REVOKED :: REVOKED;
}
/**
* Creates a new options struct.
* Can be freed with `sentry_options_free`.
*/
sentry_options_new :: () -> *sentry_options_t #foreign libsentry;
/**
* Deallocates previously allocated sentry options.
*/
sentry_options_free :: (opts: *sentry_options_t) -> void #foreign libsentry;
/**
* Sets a transport.
*/
sentry_options_set_transport :: (opts: *sentry_options_t, transport: *sentry_transport_t) -> void #foreign libsentry;
/**
* Type of the `before_send` callback.
*
* The callback takes ownership of the `event`, and should usually return that
* same event. In case the event should be discarded, the callback needs to
* call `sentry_value_decref` on the provided event, and return a
* `sentry_value_new_null()` instead.
*
* If you have set an `on_crash` callback (independent of whether it discards or
* retains the event), `before_send` will no longer be invoked for crash-events,
* which allows you to better distinguish between crashes and all other events
* in client-side pre-processing.
*
* This function may be invoked inside of a signal handler and must be safe for
* that purpose, see https://man7.org/linux/man-pages/man7/signal-safety.7.html.
* On Windows, it may be called from inside of a `UnhandledExceptionFilter`, see
* the documentation on SEH (structured exception handling) for more information
* https://docs.microsoft.com/en-us/windows/win32/debug/structured-exception-handling
*
* Up to version 0.4.18 the `before_send` callback wasn't invoked in case the
* event sampling discarded an event. In the current implementation the
* `before_send` callback is invoked even if the event sampling discards the
* event, following the cross-SDK session filter order:
*
* https://develop.sentry.dev/sdk/sessions/#filter-order
*
* On Windows the crashpad backend can capture fast-fail crashes which by-pass
* SEH. Since the `before_send` is called by a local exception-handler, it will
* not be invoked when such a crash happened, even though a minidump will be
* sent.
*/
sentry_event_function_t :: #type (event: sentry_value_t, hint: *void, closure: *void) -> sentry_value_t #c_call;
/**
* Sets the `before_send` callback.
*
* See the `sentry_event_function_t` typedef above for more information.
*/
sentry_options_set_before_send :: (opts: *sentry_options_t, func: sentry_event_function_t, data: *void) -> void #foreign libsentry;
/**
* Type of the `on_crash` callback.
*
* The `on_crash` callback replaces the `before_send` callback for crash events.
* The interface is analogous to `before_send` in that the callback takes
* ownership of the `event`, and should usually return that same event. In case
* the event should be discarded, the callback needs to call
* `sentry_value_decref` on the provided event, and return a
* `sentry_value_new_null()` instead.
*
* Only the `inproc` backend currently fills the passed-in event with useful
* data and processes any modifications to the return value. Since both
* `breakpad` and `crashpad` use minidumps to capture the crash state, the
* passed-in event is empty when using these backends, and they ignore any
* changes to the return value.
*
* If you set this callback in the options, it prevents a concurrently enabled
* `before_send` callback from being invoked in the crash case. This allows for
* better differentiation between crashes and other events and gradual migration
* from existing `before_send` implementations:
*
* - if you have a `before_send` implementation and do not define an `on_crash`
* callback your application will receive both normal and crash events as
* before
* - if you have a `before_send` implementation but only want to handle normal
* events with it, then you can define an `on_crash` callback that returns
* the passed-in event and does nothing else
* - if you are not interested in normal events, but only want to act on
* crashes (within the limits mentioned below), then only define an
* `on_crash` callback with the option to filter (on all backends) or enrich
* (only inproc) the crash event
*
* This function may be invoked inside of a signal handler and must be safe for
* that purpose, see https://man7.org/linux/man-pages/man7/signal-safety.7.html.
* On Windows, it may be called from inside of a `UnhandledExceptionFilter`, see
* the documentation on SEH (structured exception handling) for more information
* https://docs.microsoft.com/en-us/windows/win32/debug/structured-exception-handling
*
* Platform-specific behavior:
*
* - does not work with crashpad on macOS.
* - for breakpad on Linux the `uctx` parameter is always NULL.
* - on Windows the crashpad backend can capture fast-fail crashes which
* by-pass SEH. Since `on_crash` is called by a local exception-handler, it will
* not be invoked when such a crash happened, even though a minidump will be
* sent.
*/
sentry_crash_function_t :: #type (uctx: *sentry_ucontext_t, event: sentry_value_t, closure: *void) -> sentry_value_t #c_call;
/**
* Sets the `on_crash` callback.
*
* See the `sentry_crash_function_t` typedef above for more information.
*/
sentry_options_set_on_crash :: (opts: *sentry_options_t, func: sentry_crash_function_t, data: *void) -> void #foreign libsentry;
/**
* Sets the DSN.
*/
sentry_options_set_dsn :: (opts: *sentry_options_t, dsn: *u8) -> void #foreign libsentry;
sentry_options_set_dsn_n :: (opts: *sentry_options_t, dsn: *u8, dsn_len: u64) -> void #foreign libsentry;
/**
* Gets the DSN.
*/
sentry_options_get_dsn :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Sets the sample rate, which should be a double between `0.0` and `1.0`.
* Sentry will randomly discard any event that is captured using
* `sentry_capture_event` when a sample rate < 1 is set.
*
* The sampling happens at the end of the event processing according to the
* following order:
*
* https://develop.sentry.dev/sdk/sessions/#filter-order
*
* Only items 3. to 6. are currently applicable to sentry-native. This means
* each processing step is executed even if the sampling discards the event
* before sending it to the backend. This is particularly relevant to users of
* the `before_send` callback.
*
* The above is in contrast to versions up to 0.4.18 where the sampling happened
* at the beginning of the processing/filter sequence.
*/
sentry_options_set_sample_rate :: (opts: *sentry_options_t, sample_rate: float64) -> void #foreign libsentry;
/**
* Gets the sample rate.
*/
sentry_options_get_sample_rate :: (opts: *sentry_options_t) -> float64 #foreign libsentry;
/**
* Sets the release.
*/
sentry_options_set_release :: (opts: *sentry_options_t, release: *u8) -> void #foreign libsentry;
sentry_options_set_release_n :: (opts: *sentry_options_t, release: *u8, release_len: u64) -> void #foreign libsentry;
/**
* Gets the release.
*/
sentry_options_get_release :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Sets the environment.
*/
sentry_options_set_environment :: (opts: *sentry_options_t, environment: *u8) -> void #foreign libsentry;
sentry_options_set_environment_n :: (opts: *sentry_options_t, environment: *u8, environment_len: u64) -> void #foreign libsentry;
/**
* Gets the environment.
*/
sentry_options_get_environment :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Sets the dist.
*/
sentry_options_set_dist :: (opts: *sentry_options_t, dist: *u8) -> void #foreign libsentry;
sentry_options_set_dist_n :: (opts: *sentry_options_t, dist: *u8, dist_len: u64) -> void #foreign libsentry;
/**
* Gets the dist.
*/
sentry_options_get_dist :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Configures the http proxy.
*
* The given proxy has to include the full scheme, eg. `http://some.proxy/`.
*/
sentry_options_set_http_proxy :: (opts: *sentry_options_t, proxy: *u8) -> void #foreign libsentry;
sentry_options_set_http_proxy_n :: (opts: *sentry_options_t, proxy: *u8, proxy_len: u64) -> void #foreign libsentry;
/**
* Returns the configured http proxy.
*/
sentry_options_get_http_proxy :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Configures the path to a file containing ssl certificates for
* verification.
*/
sentry_options_set_ca_certs :: (opts: *sentry_options_t, path: *u8) -> void #foreign libsentry;
sentry_options_set_ca_certs_n :: (opts: *sentry_options_t, path: *u8, path_len: u64) -> void #foreign libsentry;
/**
* Returns the configured path for ca certificates.
*/
sentry_options_get_ca_certs :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Configures the name of the http transport thread.
*/
sentry_options_set_transport_thread_name :: (opts: *sentry_options_t, name: *u8) -> void #foreign libsentry;
sentry_options_set_transport_thread_name_n :: (opts: *sentry_options_t, name: *u8, name_len: u64) -> void #foreign libsentry;
/**
* Returns the configured http transport thread name.
*/
sentry_options_get_transport_thread_name :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/*
* Configures the name of the sentry SDK. Returns 0 on success.
*/
sentry_options_set_sdk_name :: (opts: *sentry_options_t, sdk_name: *u8) -> s32 #foreign libsentry;
/*
* Configures the name of the sentry SDK. Returns 0 on success.
*/
sentry_options_set_sdk_name_n :: (opts: *sentry_options_t, sdk_name: *u8, sdk_name_len: u64) -> s32 #foreign libsentry;
/**
* Returns the configured sentry SDK name. Unless overwritten this defaults to
* SENTRY_SDK_NAME.
*/
sentry_options_get_sdk_name :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Returns the user agent. Unless overwritten this defaults to
* "SENTRY_SDK_NAME / SENTRY_SDK_VERSION".
*/
sentry_options_get_user_agent :: (opts: *sentry_options_t) -> *u8 #foreign libsentry;
/**
* Enables or disables debug printing mode.
*/
sentry_options_set_debug :: (opts: *sentry_options_t, debug: s32) -> void #foreign libsentry;
/**
* Returns the current value of the debug flag.
*/
sentry_options_get_debug :: (opts: *sentry_options_t) -> s32 #foreign libsentry;
/**
* Sets the number of breadcrumbs being tracked and attached to events.
*
* Defaults to 100.
*/
sentry_options_set_max_breadcrumbs :: (opts: *sentry_options_t, max_breadcrumbs: u64) -> void #foreign libsentry;
/**
* Gets the number of breadcrumbs being tracked and attached to events.
*/
sentry_options_get_max_breadcrumbs :: (opts: *sentry_options_t) -> u64 #foreign libsentry;
/**
* Type of the callback for logger function.
*/
sentry_logger_function_t :: #type (level: sentry_level_t, message: *u8, args: va_list, userdata: *void) -> void #c_call;
/**
* Sets the sentry-native logger function.
*
* Used for logging debug events when the `debug` option is set to true.
*
* Note: Multiple threads may invoke your `func`. If you plan to mutate any data
* inside the `userdata` argument after initialization, you must ensure proper
* synchronization inside the logger function.
*
*/
sentry_options_set_logger :: (opts: *sentry_options_t, func: sentry_logger_function_t, userdata: *void) -> void #foreign libsentry;
/**
* Enables or disables automatic session tracking.
*
* Automatic session tracking is enabled by default and is equivalent to calling
* `sentry_start_session` after startup.
* There can only be one running session, and the current session will always be
* closed implicitly by `sentry_close`, when starting a new session with
* `sentry_start_session`, or manually by calling `sentry_end_session`.
*/
sentry_options_set_auto_session_tracking :: (opts: *sentry_options_t, val: s32) -> void #foreign libsentry;
/**
* Returns true if automatic session tracking is enabled.
*/
sentry_options_get_auto_session_tracking :: (opts: *sentry_options_t) -> s32 #foreign libsentry;
/**
* Enables or disables user consent requirements for uploads.
*
* This disables uploads until the user has given the consent to the SDK.
* Consent itself is given with `sentry_user_consent_give` and
* `sentry_user_consent_revoke`.
*/
sentry_options_set_require_user_consent :: (opts: *sentry_options_t, val: s32) -> void #foreign libsentry;
/**
* Returns true if user consent is required.
*/
sentry_options_get_require_user_consent :: (opts: *sentry_options_t) -> s32 #foreign libsentry;
/**
* Enables or disables on-device symbolication of stack traces.
*
* This feature can have a performance impact, and is enabled by default on
* Android. It is usually only needed when it is not possible to provide debug
* information files for system libraries which are needed for serverside
* symbolication.
*/
sentry_options_set_symbolize_stacktraces :: (opts: *sentry_options_t, val: s32) -> void #foreign libsentry;
/**
* Returns true if on-device symbolication of stack traces is enabled.
*/
sentry_options_get_symbolize_stacktraces :: (opts: *sentry_options_t) -> s32 #foreign libsentry;
/**
* Adds a new attachment to be sent along.
*
* `path` is assumed to be in platform-specific filesystem path encoding.
* API Users on windows are encouraged to use `sentry_options_add_attachmentw`
* instead.
*/
sentry_options_add_attachment :: (opts: *sentry_options_t, path: *u8) -> void #foreign libsentry;