|
1 | 1 | /* |
2 | | - * Copyright 2020 New Relic Corporation. All rights reserved. |
| 2 | + * Copyright 2024 New Relic Corporation. All rights reserved. |
3 | 3 | * SPDX-License-Identifier: Apache-2.0 |
4 | 4 | */ |
5 | 5 |
|
6 | 6 | #ifndef CSEC_METADATA_H |
7 | 7 | #define CSEC_METADATA_H |
8 | 8 |
|
9 | | -typedef struct _nr_php_csec_metadata_t { |
10 | | - int high_security; /* Indicates if high security been set locally for this |
11 | | - application */ |
12 | | - char* license; /* License key provided */ |
13 | | - char* plicense; /* Printable license (abbreviated for security) */ |
14 | | - char* host_name; /* Local host name reported to the daemon */ |
15 | | - char* entity_name; /* Entity name related to this application */ |
16 | | - char* entity_type; /* Entity type */ |
17 | | - char* account_id; /* Security : Added for getting account id */ |
18 | | - char* entity_guid; /* Entity guid related to this application */ |
19 | | - char* agent_run_id; /* The collector's agent run ID; assigned from the |
20 | | - New Relic backend */ |
21 | | -} nr_php_csec_metadata_t; |
| 9 | +typedef enum { |
| 10 | + NR_PHP_CSEC_METADATA_HIGH_SECURITY = 1, |
| 11 | + NR_PHP_CSEC_METADATA_ENTITY_NAME, |
| 12 | + NR_PHP_CSEC_METADATA_ENTITY_TYPE, |
| 13 | + NR_PHP_CSEC_METADATA_ENTITY_GUID, |
| 14 | + NR_PHP_CSEC_METADATA_HOST_NAME, |
| 15 | + NR_PHP_CSEC_METADATA_AGENT_RUN_ID, |
| 16 | + NR_PHP_CSEC_METADATA_ACCOUNT_ID, |
| 17 | + NR_PHP_CSEC_METADATA_LICENSE, |
| 18 | + NR_PHP_CSEC_METADATA_PLICENSE |
| 19 | +} nr_php_csec_metadata_key_t; |
22 | 20 |
|
23 | 21 | /* |
24 | | - * Purpose : Return app meta data by populating nr_php_csec_metadata_t |
25 | | - * structure. The caller is responsible for freeing the memory |
26 | | - * allocated for the strings in the structure. |
| 22 | + * Purpose : Copy requested app meta data into allocated *value. |
| 23 | + * The caller is responsible for freeing the memory |
| 24 | + * allocated. |
27 | 25 | * |
28 | 26 | * Params : Pointer to a nr_php_csec_metadata_t structure |
29 | 27 | * |
30 | 28 | * Returns : 0 for success |
31 | 29 | * -1 for invalid input |
32 | 30 | * -2 for invalid internal state |
| 31 | + * -3 for inability to allocate memory |
| 32 | + * -4 for invalid metadata key |
| 33 | + * -5 for inability to retrieve metadata value |
33 | 34 | */ |
34 | | -extern int nr_php_csec_get_metadata(nr_php_csec_metadata_t*); |
35 | | -typedef int (*nr_php_csec_get_metadata_t)(nr_php_csec_metadata_t*); |
| 35 | +extern int nr_php_csec_get_metadata(const nr_php_csec_metadata_key_t k, void** value); |
| 36 | +typedef int (*nr_php_csec_get_metadata_t)(const nr_php_csec_metadata_key_t k, void** value); |
36 | 37 | #define NR_PHP_CSEC_GET_METADATA "nr_php_csec_get_metadata" |
37 | 38 | #endif |
0 commit comments