-
Notifications
You must be signed in to change notification settings - Fork 171
Expand file tree
/
Copy pathcommands_helpers.h
More file actions
44 lines (37 loc) · 1.72 KB
/
commands_helpers.h
File metadata and controls
44 lines (37 loc) · 1.72 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
// Unless explicitly stated otherwise all files in this repository are
// dual-licensed under the Apache-2.0 License or BSD-3-Clause License.
//
// This product includes software developed at Datadog
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#pragma once
#include "commands_ctx.h"
#include "attributes.h"
#include "dddefs.h"
#include "network.h"
#include <mpack.h>
typedef struct _dd_command_spec {
const char *nonnull name;
size_t name_len;
size_t num_args; // outgoing args
dd_result (*nonnull outgoing_cb)(
mpack_writer_t *nonnull writer, void *unspecnull ctx);
dd_result (*nonnull incoming_cb)(mpack_node_t root, void *unspecnull ctx);
dd_result (*nonnull config_features_cb)(
mpack_node_t root, void *unspecnull ctx);
} dd_command_spec;
dd_result ATTR_WARN_UNUSED dd_command_exec(dd_conn *nonnull conn,
const dd_command_spec *nonnull spec, void *unspecnull ctx);
dd_result ATTR_WARN_UNUSED dd_command_exec_req_info(dd_conn *nonnull conn,
const dd_command_spec *nonnull spec, struct req_info *nonnull ctx);
dd_result ATTR_WARN_UNUSED dd_command_exec_cred(dd_conn *nonnull conn,
const dd_command_spec *nonnull spec, void *unspecnull ctx);
/* Baked response */
dd_result dd_command_proc_resp_verd_span_data(mpack_node_t root,
void *unspecnull ctx /* actually struct req_info* nonnull */);
/* Common helpers */
void dd_command_process_meta(mpack_node_t root, zend_object *nonnull span);
bool dd_command_process_metrics(mpack_node_t root, zend_object *nonnull span);
dd_result dd_command_process_config_features(
mpack_node_t root, ATTR_UNUSED void *nullable ctx);
dd_result dd_command_process_config_features_unexpected(
mpack_node_t root, ATTR_UNUSED void *nullable ctx);