-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathcommon.h
More file actions
2075 lines (1813 loc) · 60.8 KB
/
common.h
File metadata and controls
2075 lines (1813 loc) · 60.8 KB
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
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0
#ifndef DDOG_COMMON_H
#define DDOG_COMMON_H
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define DDOG_CHARSLICE_C(string) \
/* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddog_CharSlice){ .ptr = "" string, .len = sizeof(string) - 1 })
#define DDOG_CHARSLICE_C_BARE(string) \
/* NOTE: Compilation fails if you pass in a char* instead of a literal */ { .ptr = "" string, .len = sizeof(string) - 1 }
#if defined __GNUC__
# define DDOG_GNUC_VERSION(major) __GNUC__ >= major
#else
# define DDOG_GNUC_VERSION(major) (0)
#endif
#if defined __has_attribute
# define DDOG_HAS_ATTRIBUTE(attribute, major) __has_attribute(attribute)
#else
# define DDOG_HAS_ATTRIBUTE(attribute, major) DDOG_GNUC_VERSION(major)
#endif
#if defined(__cplusplus) && (__cplusplus >= 201703L)
# define DDOG_CHECK_RETURN [[nodiscard]]
#elif defined(_Check_return_) /* SAL */
# define DDOG_CHECK_RETURN _Check_return_
#elif DDOG_HAS_ATTRIBUTE(warn_unused_result, 4)
# define DDOG_CHECK_RETURN __attribute__((__warn_unused_result__))
#else
# define DDOG_CHECK_RETURN
#endif
#ifdef _WIN32
#define LIBDD_DLLIMPORT __declspec(dllimport)
#else
#define LIBDD_DLLIMPORT
#endif
/**
* Default value for the timeout field in milliseconds.
*/
#define ddog_Endpoint_DEFAULT_TIMEOUT 3000
typedef struct ddog_Endpoint ddog_Endpoint;
typedef struct ddog_Tag ddog_Tag;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_U8 {
const uint8_t *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_U8;
/**
* Please treat this as opaque; do not reach into it, and especially don't
* write into it! The most relevant APIs are:
* * `ddog_Error_message`, to get the message as a slice.
* * `ddog_Error_drop`.
*/
typedef struct ddog_Error {
/**
* This is a String stuffed into the vec.
*/
struct ddog_Vec_U8 message;
} ddog_Error;
typedef struct ddog_Slice_CChar {
/**
* Should be non-null and suitably aligned for the underlying type. It is
* allowed but not recommended for the pointer to be null when the len is
* zero.
*/
const char *ptr;
/**
* The number of elements (not bytes) that `.ptr` points to. Must be less
* than or equal to [isize::MAX].
*/
uintptr_t len;
} ddog_Slice_CChar;
/**
* Use to represent strings -- should be valid UTF-8.
*/
typedef struct ddog_Slice_CChar ddog_CharSlice;
typedef enum ddog_Option_Error_Tag {
DDOG_OPTION_ERROR_SOME_ERROR,
DDOG_OPTION_ERROR_NONE_ERROR,
} ddog_Option_Error_Tag;
typedef struct ddog_Option_Error {
ddog_Option_Error_Tag tag;
union {
struct {
struct ddog_Error some;
};
};
} ddog_Option_Error;
typedef struct ddog_Option_Error ddog_MaybeError;
typedef struct ddog_ArrayQueue {
struct ddog_ArrayQueue *inner;
void (*item_delete_fn)(void*);
} ddog_ArrayQueue;
typedef enum ddog_ArrayQueue_NewResult_Tag {
DDOG_ARRAY_QUEUE_NEW_RESULT_OK,
DDOG_ARRAY_QUEUE_NEW_RESULT_ERR,
} ddog_ArrayQueue_NewResult_Tag;
typedef struct ddog_ArrayQueue_NewResult {
ddog_ArrayQueue_NewResult_Tag tag;
union {
struct {
struct ddog_ArrayQueue *ok;
};
struct {
struct ddog_Error err;
};
};
} ddog_ArrayQueue_NewResult;
/**
* Data structure for the result of the push() and force_push() functions.
* force_push() replaces the oldest element if the queue is full, while push() returns the given
* value if the queue is full. For push(), it's redundant to return the value since the caller
* already has it, but it's returned for consistency with crossbeam API and with force_push().
*/
typedef enum ddog_ArrayQueue_PushResult_Tag {
DDOG_ARRAY_QUEUE_PUSH_RESULT_OK,
DDOG_ARRAY_QUEUE_PUSH_RESULT_FULL,
DDOG_ARRAY_QUEUE_PUSH_RESULT_ERR,
} ddog_ArrayQueue_PushResult_Tag;
typedef struct ddog_ArrayQueue_PushResult {
ddog_ArrayQueue_PushResult_Tag tag;
union {
struct {
void *full;
};
struct {
struct ddog_Error err;
};
};
} ddog_ArrayQueue_PushResult;
typedef enum ddog_ArrayQueue_PopResult_Tag {
DDOG_ARRAY_QUEUE_POP_RESULT_OK,
DDOG_ARRAY_QUEUE_POP_RESULT_EMPTY,
DDOG_ARRAY_QUEUE_POP_RESULT_ERR,
} ddog_ArrayQueue_PopResult_Tag;
typedef struct ddog_ArrayQueue_PopResult {
ddog_ArrayQueue_PopResult_Tag tag;
union {
struct {
void *ok;
};
struct {
struct ddog_Error err;
};
};
} ddog_ArrayQueue_PopResult;
typedef enum ddog_ArrayQueue_BoolResult_Tag {
DDOG_ARRAY_QUEUE_BOOL_RESULT_OK,
DDOG_ARRAY_QUEUE_BOOL_RESULT_ERR,
} ddog_ArrayQueue_BoolResult_Tag;
typedef struct ddog_ArrayQueue_BoolResult {
ddog_ArrayQueue_BoolResult_Tag tag;
union {
struct {
bool ok;
};
struct {
struct ddog_Error err;
};
};
} ddog_ArrayQueue_BoolResult;
typedef enum ddog_ArrayQueue_UsizeResult_Tag {
DDOG_ARRAY_QUEUE_USIZE_RESULT_OK,
DDOG_ARRAY_QUEUE_USIZE_RESULT_ERR,
} ddog_ArrayQueue_UsizeResult_Tag;
typedef struct ddog_ArrayQueue_UsizeResult {
ddog_ArrayQueue_UsizeResult_Tag tag;
union {
struct {
uintptr_t ok;
};
struct {
struct ddog_Error err;
};
};
} ddog_ArrayQueue_UsizeResult;
typedef enum ddog_Option_U32_Tag {
DDOG_OPTION_U32_SOME_U32,
DDOG_OPTION_U32_NONE_U32,
} ddog_Option_U32_Tag;
typedef struct ddog_Option_U32 {
ddog_Option_U32_Tag tag;
union {
struct {
uint32_t some;
};
};
} ddog_Option_U32;
/**
* A wrapper for returning owned strings from FFI
*/
typedef struct ddog_StringWrapper {
/**
* This is a String stuffed into the vec.
*/
struct ddog_Vec_U8 message;
} ddog_StringWrapper;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_Tag {
const struct ddog_Tag *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_Tag;
typedef enum ddog_Vec_Tag_PushResult_Tag {
DDOG_VEC_TAG_PUSH_RESULT_OK,
DDOG_VEC_TAG_PUSH_RESULT_ERR,
} ddog_Vec_Tag_PushResult_Tag;
typedef struct ddog_Vec_Tag_PushResult {
ddog_Vec_Tag_PushResult_Tag tag;
union {
struct {
struct ddog_Error err;
};
};
} ddog_Vec_Tag_PushResult;
typedef struct ddog_Vec_Tag_ParseResult {
struct ddog_Vec_Tag tags;
struct ddog_Error *error_message;
} ddog_Vec_Tag_ParseResult;
typedef struct _zend_string _zend_string;
#define ddog_LOG_ONCE (1 << 3)
/**
* Number of gRPC status-code keys checked by the stats aggregation (must match
* `GRPC_STATUS_CODE_FIELD` in libdd-trace-stats/src/span_concentrator/aggregation.rs).
*/
#define ddog_PHP_GRPC_KEY_COUNT 4
#define ddog_MultiTargetFetcher_DEFAULT_CLIENTS_LIMIT 100
typedef enum ddog_ConfigurationOrigin {
DDOG_CONFIGURATION_ORIGIN_ENV_VAR,
DDOG_CONFIGURATION_ORIGIN_CODE,
DDOG_CONFIGURATION_ORIGIN_DD_CONFIG,
DDOG_CONFIGURATION_ORIGIN_REMOTE_CONFIG,
DDOG_CONFIGURATION_ORIGIN_DEFAULT,
DDOG_CONFIGURATION_ORIGIN_LOCAL_STABLE_CONFIG,
DDOG_CONFIGURATION_ORIGIN_FLEET_STABLE_CONFIG,
DDOG_CONFIGURATION_ORIGIN_CALCULATED,
} ddog_ConfigurationOrigin;
typedef enum ddog_DynamicConfigUpdateMode {
DDOG_DYNAMIC_CONFIG_UPDATE_MODE_READ,
DDOG_DYNAMIC_CONFIG_UPDATE_MODE_READ_WRITE,
DDOG_DYNAMIC_CONFIG_UPDATE_MODE_WRITE,
DDOG_DYNAMIC_CONFIG_UPDATE_MODE_RESTORE,
} ddog_DynamicConfigUpdateMode;
typedef enum ddog_EvaluateAt {
DDOG_EVALUATE_AT_ENTRY,
DDOG_EVALUATE_AT_EXIT,
} ddog_EvaluateAt;
typedef enum ddog_InBodyLocation {
DDOG_IN_BODY_LOCATION_NONE,
DDOG_IN_BODY_LOCATION_START,
DDOG_IN_BODY_LOCATION_END,
} ddog_InBodyLocation;
typedef enum ddog_Log {
DDOG_LOG_ERROR = 1,
DDOG_LOG_WARN = 2,
DDOG_LOG_INFO = 3,
DDOG_LOG_DEBUG = 4,
DDOG_LOG_TRACE = 5,
DDOG_LOG_DEPRECATED = (3 | ddog_LOG_ONCE),
DDOG_LOG_STARTUP = (3 | (2 << 4)),
DDOG_LOG_STARTUP_WARN = (1 | (2 << 4)),
DDOG_LOG_SPAN = (4 | (3 << 4)),
DDOG_LOG_SPAN_TRACE = (5 | (3 << 4)),
DDOG_LOG_HOOK_TRACE = (5 | (4 << 4)),
} ddog_Log;
typedef enum ddog_Method {
DDOG_METHOD_GET = 0,
DDOG_METHOD_POST = 1,
DDOG_METHOD_PUT = 2,
DDOG_METHOD_DELETE = 3,
DDOG_METHOD_PATCH = 4,
DDOG_METHOD_HEAD = 5,
DDOG_METHOD_OPTIONS = 6,
DDOG_METHOD_TRACE = 7,
DDOG_METHOD_CONNECT = 8,
DDOG_METHOD_OTHER = 9,
} ddog_Method;
typedef enum ddog_MetricKind {
DDOG_METRIC_KIND_COUNT,
DDOG_METRIC_KIND_GAUGE,
DDOG_METRIC_KIND_HISTOGRAM,
DDOG_METRIC_KIND_DISTRIBUTION,
} ddog_MetricKind;
typedef enum ddog_MetricNamespace {
DDOG_METRIC_NAMESPACE_TRACERS,
DDOG_METRIC_NAMESPACE_PROFILERS,
DDOG_METRIC_NAMESPACE_RUM,
DDOG_METRIC_NAMESPACE_APPSEC,
DDOG_METRIC_NAMESPACE_IDE_PLUGINS,
DDOG_METRIC_NAMESPACE_LIVE_DEBUGGER,
DDOG_METRIC_NAMESPACE_IAST,
DDOG_METRIC_NAMESPACE_GENERAL,
DDOG_METRIC_NAMESPACE_TELEMETRY,
DDOG_METRIC_NAMESPACE_APM,
DDOG_METRIC_NAMESPACE_SIDECAR,
} ddog_MetricNamespace;
typedef enum ddog_MetricType {
DDOG_METRIC_TYPE_GAUGE,
DDOG_METRIC_TYPE_COUNT,
DDOG_METRIC_TYPE_DISTRIBUTION,
} ddog_MetricType;
typedef enum ddog_ProbeStatus {
DDOG_PROBE_STATUS_RECEIVED,
DDOG_PROBE_STATUS_INSTALLED,
DDOG_PROBE_STATUS_EMITTING,
DDOG_PROBE_STATUS_ERROR,
DDOG_PROBE_STATUS_BLOCKED,
DDOG_PROBE_STATUS_WARNING,
} ddog_ProbeStatus;
typedef enum ddog_RemoteConfigCapabilities {
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_ACTIVATION = 1,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_IP_BLOCKING = 2,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_DD_RULES = 3,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_EXCLUSIONS = 4,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_REQUEST_BLOCKING = 5,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RESPONSE_BLOCKING = 6,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_USER_BLOCKING = 7,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_CUSTOM_RULES = 8,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_CUSTOM_BLOCKING_RESPONSE = 9,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_TRUSTED_IPS = 10,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_API_SECURITY_SAMPLE_RATE = 11,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_SAMPLE_RATE = 12,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_LOGS_INJECTION = 13,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_HTTP_HEADER_TAGS = 14,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_CUSTOM_TAGS = 15,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_PROCESSOR_OVERRIDES = 16,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_CUSTOM_DATA_SCANNERS = 17,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_EXCLUSION_DATA = 18,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_ENABLED = 19,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_DATA_STREAMS_ENABLED = 20,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_SQLI = 21,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_LFI = 22,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_SSRF = 23,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_SHI = 24,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_XXE = 25,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_RCE = 26,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_NOSQLI = 27,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_XSS = 28,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_SAMPLE_RULES = 29,
DDOG_REMOTE_CONFIG_CAPABILITIES_CSM_ACTIVATION = 30,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_AUTO_USER_INSTRUM_MODE = 31,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_ENDPOINT_FINGERPRINT = 32,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_SESSION_FINGERPRINT = 33,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_NETWORK_FINGERPRINT = 34,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_HEADER_FINGERPRINT = 35,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_TRUNCATION_RULES = 36,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_RASP_CMDI = 37,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_ENABLE_DYNAMIC_INSTRUMENTATION = 38,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_ENABLE_EXCEPTION_REPLAY = 39,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_ENABLE_CODE_ORIGIN = 40,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_ENABLE_LIVE_DEBUGGING = 41,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_DD_MULTICONFIG = 42,
DDOG_REMOTE_CONFIG_CAPABILITIES_ASM_TRACE_TAGGING_RULES = 43,
DDOG_REMOTE_CONFIG_CAPABILITIES_APM_TRACING_MULTICONFIG = 45,
DDOG_REMOTE_CONFIG_CAPABILITIES_FFE_FLAG_CONFIGURATION_RULES = 46,
} ddog_RemoteConfigCapabilities;
typedef enum ddog_RemoteConfigProduct {
DDOG_REMOTE_CONFIG_PRODUCT_AGENT_CONFIG,
DDOG_REMOTE_CONFIG_PRODUCT_AGENT_TASK,
DDOG_REMOTE_CONFIG_PRODUCT_APM_TRACING,
DDOG_REMOTE_CONFIG_PRODUCT_ASM,
DDOG_REMOTE_CONFIG_PRODUCT_ASM_DATA,
DDOG_REMOTE_CONFIG_PRODUCT_ASM_DD,
DDOG_REMOTE_CONFIG_PRODUCT_ASM_FEATURES,
DDOG_REMOTE_CONFIG_PRODUCT_FFE_FLAGS,
DDOG_REMOTE_CONFIG_PRODUCT_LIVE_DEBUGGER,
} ddog_RemoteConfigProduct;
typedef enum ddog_SpanProbeTarget {
DDOG_SPAN_PROBE_TARGET_ACTIVE,
DDOG_SPAN_PROBE_TARGET_ROOT,
} ddog_SpanProbeTarget;
typedef struct ddog_AgentInfoReader ddog_AgentInfoReader;
typedef struct ddog_DebuggerPayload ddog_DebuggerPayload;
typedef struct ddog_DslString ddog_DslString;
typedef struct ddog_HashMap_ShmCacheKey__ShmCache ddog_HashMap_ShmCacheKey__ShmCache;
/**
* `InstanceId` is a structure that holds session and runtime identifiers.
*/
typedef struct ddog_InstanceId ddog_InstanceId;
typedef struct ddog_MaybeShmLimiter ddog_MaybeShmLimiter;
typedef struct ddog_ProbeCondition ddog_ProbeCondition;
typedef struct ddog_ProbeValue ddog_ProbeValue;
typedef struct ddog_RemoteConfigState ddog_RemoteConfigState;
typedef struct ddog_SidecarActionsBuffer ddog_SidecarActionsBuffer;
/**
* `SidecarTransport` wraps a [`SidecarSender`] with transparent reconnection support.
*
* This transport is used for communication between different parts of the sidecar service.
* It is a blocking transport (all operations block the current thread).
*/
typedef struct ddog_SidecarTransport ddog_SidecarTransport;
/**
* Opaque shared-memory span stats concentrator exposed to C.
*
* Always heap-allocated (as a `Box`) — C holds a raw pointer and must pass it back to
* `ddog_span_concentrator_drop` to free.
*
* When `inner` is `None` this is a *virtual* concentrator: the SHM has not been created by the
* sidecar yet, but peer-tag keys and span-kinds from `DESIRED_CONFIG` are still available so the
* C callback can run eligibility checks and extract peer tags. A virtual concentrator is always
* considered stale (`needs_refresh` returns `true`) so it will be upgraded to a real one on the
* next call once the SHM becomes available.
*/
typedef struct ddog_SpanConcentrator ddog_SpanConcentrator;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_CChar {
const char *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_CChar;
typedef struct ddog_Tag {
ddog_CharSlice name;
const struct ddog_DslString *value;
} ddog_Tag;
typedef struct _zend_string *ddog_OwnedZendString;
typedef struct _zend_string *(*ddog_DynamicConfigUpdate)(ddog_CharSlice config,
ddog_OwnedZendString value,
enum ddog_DynamicConfigUpdateMode mode);
typedef enum ddog_IntermediateValue_Tag {
DDOG_INTERMEDIATE_VALUE_STRING,
DDOG_INTERMEDIATE_VALUE_NUMBER,
DDOG_INTERMEDIATE_VALUE_BOOL,
DDOG_INTERMEDIATE_VALUE_NULL,
DDOG_INTERMEDIATE_VALUE_REFERENCED,
} ddog_IntermediateValue_Tag;
typedef struct ddog_IntermediateValue {
ddog_IntermediateValue_Tag tag;
union {
struct {
ddog_CharSlice string;
};
struct {
double number;
};
struct {
bool bool_;
};
struct {
const void *referenced;
};
};
} ddog_IntermediateValue;
typedef struct ddog_VoidCollection {
intptr_t count;
const void *elements;
void (*free)(struct ddog_VoidCollection);
} ddog_VoidCollection;
typedef struct ddog_Evaluator {
bool (*equals)(void*, struct ddog_IntermediateValue, struct ddog_IntermediateValue);
bool (*greater_than)(void*, struct ddog_IntermediateValue, struct ddog_IntermediateValue);
bool (*greater_or_equals)(void*, struct ddog_IntermediateValue, struct ddog_IntermediateValue);
const void *(*fetch_identifier)(void*, const ddog_CharSlice*);
const void *(*fetch_index)(void*, const void*, struct ddog_IntermediateValue);
const void *(*fetch_nested)(void*, const void*, struct ddog_IntermediateValue);
uintptr_t (*length)(void*, const void*);
struct ddog_VoidCollection (*try_enumerate)(void*, const void*);
ddog_CharSlice (*stringify)(void*, const void*);
ddog_CharSlice (*get_string)(void*, const void*);
intptr_t (*convert_index)(void*, const void*);
bool (*instanceof)(void*, const void*, const ddog_CharSlice*);
} ddog_Evaluator;
typedef struct ddog_CharSliceVec {
const ddog_CharSlice *strings;
uintptr_t string_count;
} ddog_CharSliceVec;
typedef enum ddog_Option_CharSlice_Tag {
DDOG_OPTION_CHAR_SLICE_SOME_CHAR_SLICE,
DDOG_OPTION_CHAR_SLICE_NONE_CHAR_SLICE,
} ddog_Option_CharSlice_Tag;
typedef struct ddog_Option_CharSlice {
ddog_Option_CharSlice_Tag tag;
union {
struct {
ddog_CharSlice some;
};
};
} ddog_Option_CharSlice;
typedef struct ddog_ProbeTarget {
ddog_CharSlice type_name;
ddog_CharSlice method_name;
ddog_CharSlice source_file;
struct ddog_Option_CharSlice signature;
const uint32_t *lines;
uint32_t lines_count;
enum ddog_InBodyLocation in_body_location;
} ddog_ProbeTarget;
typedef struct ddog_MetricProbe {
enum ddog_MetricKind kind;
ddog_CharSlice name;
const struct ddog_ProbeValue *value;
} ddog_MetricProbe;
typedef struct ddog_CaptureConfiguration {
uint32_t max_reference_depth;
uint32_t max_collection_size;
uint32_t max_length;
uint32_t max_field_count;
} ddog_CaptureConfiguration;
typedef struct ddog_CaptureExpression {
ddog_CharSlice name;
const struct ddog_ProbeValue *expr;
const struct ddog_CaptureConfiguration *capture;
} ddog_CaptureExpression;
typedef struct ddog_LogProbe {
const struct ddog_DslString *segments;
const struct ddog_ProbeCondition *when;
const struct ddog_CaptureConfiguration *capture;
bool capture_snapshot;
uint32_t sampling_snapshots_per_second;
const struct ddog_CaptureExpression *capture_expressions;
uintptr_t capture_expressions_num;
} ddog_LogProbe;
typedef struct ddog_SpanProbeTag {
struct ddog_Tag tag;
bool next_condition;
} ddog_SpanProbeTag;
typedef struct ddog_SpanDecorationProbe {
enum ddog_SpanProbeTarget target;
const struct ddog_ProbeCondition *const *conditions;
const struct ddog_SpanProbeTag *span_tags;
uintptr_t span_tags_num;
} ddog_SpanDecorationProbe;
typedef enum ddog_ProbeType_Tag {
DDOG_PROBE_TYPE_METRIC,
DDOG_PROBE_TYPE_LOG,
DDOG_PROBE_TYPE_SPAN,
DDOG_PROBE_TYPE_SPAN_DECORATION,
} ddog_ProbeType_Tag;
typedef struct ddog_ProbeType {
ddog_ProbeType_Tag tag;
union {
struct {
struct ddog_MetricProbe metric;
};
struct {
struct ddog_LogProbe log;
};
struct {
struct ddog_SpanDecorationProbe span_decoration;
};
};
} ddog_ProbeType;
typedef struct ddog_Probe {
ddog_CharSlice id;
uint64_t version;
ddog_CharSlice language;
struct ddog_CharSliceVec tags;
struct ddog_ProbeTarget target;
enum ddog_EvaluateAt evaluate_at;
struct ddog_ProbeType probe;
ddog_CharSlice diagnostic_msg;
enum ddog_ProbeStatus status;
ddog_CharSlice status_msg;
ddog_CharSlice status_exception;
ddog_CharSlice status_stacktrace;
} ddog_Probe;
typedef struct ddog_LiveDebuggerCallbacks {
int64_t (*set_probe)(struct ddog_Probe probe, const struct ddog_MaybeShmLimiter *limiter);
void (*remove_probe)(int64_t id);
} ddog_LiveDebuggerCallbacks;
typedef struct ddog_LiveDebuggerSetup {
const struct ddog_Evaluator *evaluator;
struct ddog_LiveDebuggerCallbacks callbacks;
} ddog_LiveDebuggerSetup;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_DebuggerPayload {
const struct ddog_DebuggerPayload *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_DebuggerPayload;
/**
* `QueueId` is a struct that represents a unique identifier for a queue.
* It contains a single field, `inner`, which is a 64-bit unsigned integer.
*/
typedef uint64_t ddog_QueueId;
/**
* A (key, value) pair for peer-service tags, borrowed from PHP/concentrator memory.
*/
typedef struct ddog_PhpPeerTag {
/**
* Key string — borrows from the concentrator's `peer_tag_keys` Vec<String>.
*/
ddog_CharSlice key;
/**
* Value string — borrows from PHP span meta memory.
*/
ddog_CharSlice value;
} ddog_PhpPeerTag;
/**
* Flat representation of a PHP span's stats-relevant fields, filled by C code in one call.
*
* All `CharSlice` fields borrow from PHP memory (or from the concentrator for peer-tag keys) and
* must remain valid for the duration of `ddog_span_concentrator_add_php_span`.
*
* For absent optional strings pass an empty slice (ptr may be non-null with len == 0).
* For absent optional `f64` values pass `f64::NAN`.
*/
typedef struct ddog_PhpSpanStats {
ddog_CharSlice service;
ddog_CharSlice resource;
ddog_CharSlice name;
ddog_CharSlice type;
int64_t start;
int64_t duration;
bool is_error;
bool is_trace_root;
bool is_measured;
bool has_top_level;
bool is_partial_snapshot;
ddog_CharSlice span_kind;
ddog_CharSlice http_status_code;
ddog_CharSlice http_method;
ddog_CharSlice http_endpoint;
ddog_CharSlice http_route;
ddog_CharSlice origin;
/**
* Value of the `_dd.svc_src` meta tag; empty slice when absent.
*/
ddog_CharSlice service_source;
/**
* gRPC meta values in order: rpc.grpc.status_code, grpc.code, rpc.grpc.status.code,
* grpc.status.code. Empty slice = absent.
*/
ddog_CharSlice grpc_meta[ddog_PHP_GRPC_KEY_COUNT];
/**
* Same gRPC keys but from metrics (NaN = absent).
*/
double grpc_metrics[ddog_PHP_GRPC_KEY_COUNT];
/**
* Number of (key,value) pairs in `peer_tags`.
*/
uintptr_t peer_tags_count;
/**
* Pointer to an array of `peer_tags_count` `PhpPeerTag` pairs.
* May be null when `peer_tags_count == 0`.
*/
const struct ddog_PhpPeerTag *peer_tags;
} ddog_PhpSpanStats;
typedef struct ddog_HashMap_ShmCacheKey__ShmCache ddog_ShmCacheMap;
/**
* Fast path: exact-key lookup into a root span. Returns null when the key is absent.
*/
typedef const char *(*ddog_RootTagLookupFn)(const void *ctx,
const char *key,
uintptr_t key_len,
uintptr_t *out_len);
/**
* Per-entry callback passed to `RootMetaIterFn`. Return `false` to stop iteration early.
*/
typedef bool (*ddog_MetaEntryCb)(void *iter_ctx,
const char *key,
uintptr_t key_len,
const char *val,
uintptr_t val_len);
/**
* Slow-path meta iterator. `NULL` when no regex-key filter entries are present.
* Iterates all string meta entries, calling `cb` for each; stops when `cb` returns `false`.
*/
typedef void (*ddog_RootMetaIterFn)(const void *ctx, void *iter_ctx, ddog_MetaEntryCb cb);
/**
* A 128-bit (16 byte) buffer containing the UUID.
*
* # ABI
*
* The `Bytes` type is always guaranteed to be have the same ABI as [`Uuid`].
*/
typedef uint8_t ddog_Bytes[16];
/**
* A Universally Unique Identifier (UUID).
*
* # Examples
*
* Parse a UUID given in the simple format and print it as a urn:
*
* ```
* # use uuid::Uuid;
* # fn main() -> Result<(), uuid::Error> {
* let my_uuid = Uuid::parse_str("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8")?;
*
* println!("{}", my_uuid.urn());
* # Ok(())
* # }
* ```
*
* Create a new random (V4) UUID and print it out in hexadecimal form:
*
* ```
* // Note that this requires the `v4` feature enabled in the uuid crate.
* # use uuid::Uuid;
* # fn main() {
* # #[cfg(feature = "v4")] {
* let my_uuid = Uuid::new_v4();
*
* println!("{}", my_uuid);
* # }
* # }
* ```
*
* # Formatting
*
* A UUID can be formatted in one of a few ways:
*
* * [`simple`](#method.simple): `a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8`.
* * [`hyphenated`](#method.hyphenated):
* `a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8`.
* * [`urn`](#method.urn): `urn:uuid:A1A2A3A4-B1B2-C1C2-D1D2-D3D4D5D6D7D8`.
* * [`braced`](#method.braced): `{a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8}`.
*
* The default representation when formatting a UUID with `Display` is
* hyphenated:
*
* ```
* # use uuid::Uuid;
* # fn main() -> Result<(), uuid::Error> {
* let my_uuid = Uuid::parse_str("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8")?;
*
* assert_eq!(
* "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8",
* my_uuid.to_string(),
* );
* # Ok(())
* # }
* ```
*
* Other formats can be specified using adapter methods on the UUID:
*
* ```
* # use uuid::Uuid;
* # fn main() -> Result<(), uuid::Error> {
* let my_uuid = Uuid::parse_str("a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8")?;
*
* assert_eq!(
* "urn:uuid:a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8",
* my_uuid.urn().to_string(),
* );
* # Ok(())
* # }
* ```
*
* # Endianness
*
* The specification for UUIDs encodes the integer fields that make up the
* value in big-endian order. This crate assumes integer inputs are already in
* the correct order by default, regardless of the endianness of the
* environment. Most methods that accept integers have a `_le` variant (such as
* `from_fields_le`) that assumes any integer values will need to have their
* bytes flipped, regardless of the endianness of the environment.
*
* Most users won't need to worry about endianness unless they need to operate
* on individual fields (such as when converting between Microsoft GUIDs). The
* important things to remember are:
*
* - The endianness is in terms of the fields of the UUID, not the environment.
* - The endianness is assumed to be big-endian when there's no `_le` suffix
* somewhere.
* - Byte-flipping in `_le` methods applies to each integer.
* - Endianness roundtrips, so if you create a UUID with `from_fields_le`
* you'll get the same values back out with `to_fields_le`.
*
* # ABI
*
* The `Uuid` type is always guaranteed to be have the same ABI as [`Bytes`].
*/
typedef ddog_Bytes ddog_Uuid;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_RemoteConfigProduct {
const enum ddog_RemoteConfigProduct *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_RemoteConfigProduct;
typedef struct ddog_Vec_RemoteConfigProduct ddog_VecRemoteConfigProduct;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_RemoteConfigCapabilities {
const enum ddog_RemoteConfigCapabilities *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_RemoteConfigCapabilities;
typedef struct ddog_Vec_RemoteConfigCapabilities ddog_VecRemoteConfigCapabilities;
#define ddog_DYANMIC_CONFIG_UPDATE_UNMODIFIED (_zend_string*)1
typedef struct ddog_DebuggerCapture ddog_DebuggerCapture;
typedef struct ddog_DebuggerValue ddog_DebuggerValue;
#define ddog_EVALUATOR_RESULT_UNDEFINED (const void*)0
#define ddog_EVALUATOR_RESULT_INVALID (const void*)-1
#define ddog_EVALUATOR_RESULT_REDACTED (const void*)-2
typedef enum ddog_DebuggerType {
DDOG_DEBUGGER_TYPE_DIAGNOSTICS,
DDOG_DEBUGGER_TYPE_SNAPSHOTS,
DDOG_DEBUGGER_TYPE_LOGS,
} ddog_DebuggerType;
typedef enum ddog_FieldType {
DDOG_FIELD_TYPE_STATIC,
DDOG_FIELD_TYPE_ARG,
DDOG_FIELD_TYPE_LOCAL,
} ddog_FieldType;
typedef struct ddog_Entry ddog_Entry;
typedef struct ddog_HashMap_CowStr__Value ddog_HashMap_CowStr__Value;
typedef struct ddog_InternalIntermediateValue ddog_InternalIntermediateValue;
typedef struct ddog_SenderHandle ddog_SenderHandle;
typedef struct ddog_SnapshotEvaluationError ddog_SnapshotEvaluationError;
typedef struct ddog_String ddog_String;
/**
* Holds the raw parts of a Rust Vec; it should only be created from Rust,
* never from C.
*/
typedef struct ddog_Vec_SnapshotEvaluationError {
const struct ddog_SnapshotEvaluationError *ptr;
uintptr_t len;
uintptr_t capacity;
} ddog_Vec_SnapshotEvaluationError;
typedef enum ddog_ConditionEvaluationResult_Tag {
DDOG_CONDITION_EVALUATION_RESULT_SUCCESS,
DDOG_CONDITION_EVALUATION_RESULT_FAILURE,
DDOG_CONDITION_EVALUATION_RESULT_ERROR,
} ddog_ConditionEvaluationResult_Tag;
typedef struct ddog_ConditionEvaluationResult {
ddog_ConditionEvaluationResult_Tag tag;
union {
struct {
struct ddog_Vec_SnapshotEvaluationError *error;
};
};
} ddog_ConditionEvaluationResult;
typedef enum ddog_ValueEvaluationResult_Tag {
DDOG_VALUE_EVALUATION_RESULT_SUCCESS,
DDOG_VALUE_EVALUATION_RESULT_ERROR,
} ddog_ValueEvaluationResult_Tag;
typedef struct ddog_ValueEvaluationResult {
ddog_ValueEvaluationResult_Tag tag;
union {
struct {
struct ddog_InternalIntermediateValue *success;
};
struct {
struct ddog_Vec_SnapshotEvaluationError *error;
};
};
} ddog_ValueEvaluationResult;
typedef struct ddog_FilterList {
struct ddog_CharSliceVec package_prefixes;
struct ddog_CharSliceVec classes;
} ddog_FilterList;
typedef struct ddog_ServiceConfiguration {
ddog_CharSlice id;
struct ddog_FilterList allow;
struct ddog_FilterList deny;
uint32_t sampling_snapshots_per_second;
} ddog_ServiceConfiguration;
typedef enum ddog_LiveDebuggingData_Tag {
DDOG_LIVE_DEBUGGING_DATA_NONE,
DDOG_LIVE_DEBUGGING_DATA_PROBE,
DDOG_LIVE_DEBUGGING_DATA_SERVICE_CONFIGURATION,
} ddog_LiveDebuggingData_Tag;
typedef struct ddog_LiveDebuggingData {
ddog_LiveDebuggingData_Tag tag;