-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor to avoid 'transport' struct
Replace 'transport' struct, which would have to be versioned, with a simple getter API of `get(key, &ptr)` signature.
- Loading branch information
Showing
2 changed files
with
68 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* Copyright 2024 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef CSEC_METADATA_H | ||
#define CSEC_METADATA_H | ||
|
||
typedef struct _nr_php_csec_metadata_t { | ||
int high_security; /* Indicates if high security been set locally for this | ||
application */ | ||
char* license; /* License key provided */ | ||
char* plicense; /* Printable license (abbreviated for security) */ | ||
char* host_name; /* Local host name reported to the daemon */ | ||
char* entity_name; /* Entity name related to this application */ | ||
char* entity_type; /* Entity type */ | ||
char* account_id; /* Security : Added for getting account id */ | ||
char* entity_guid; /* Entity guid related to this application */ | ||
char* agent_run_id; /* The collector's agent run ID; assigned from the | ||
New Relic backend */ | ||
} nr_php_csec_metadata_t; | ||
typedef enum { | ||
NR_PHP_CSEC_METADATA_HIGH_SECURITY = 1, | ||
NR_PHP_CSEC_METADATA_ENTITY_NAME, | ||
NR_PHP_CSEC_METADATA_ENTITY_TYPE, | ||
NR_PHP_CSEC_METADATA_ENTITY_GUID, | ||
NR_PHP_CSEC_METADATA_HOST_NAME, | ||
NR_PHP_CSEC_METADATA_AGENT_RUN_ID, | ||
NR_PHP_CSEC_METADATA_ACCOUNT_ID, | ||
NR_PHP_CSEC_METADATA_LICENSE, | ||
NR_PHP_CSEC_METADATA_PLICENSE | ||
} nr_php_csec_metadata_key_t; | ||
|
||
/* | ||
* Purpose : Return app meta data by populating nr_php_csec_metadata_t | ||
* structure. The caller is responsible for freeing the memory | ||
* allocated for the strings in the structure. | ||
* Purpose : Copy requested app meta data into allocated *value. | ||
* The caller is responsible for freeing the memory | ||
* allocated. | ||
* | ||
* Params : Pointer to a nr_php_csec_metadata_t structure | ||
* | ||
* Returns : 0 for success | ||
* -1 for invalid input | ||
* -2 for invalid internal state | ||
* -3 for inability to allocate memory | ||
* -4 for invalid metadata key | ||
* -5 for inability to retrieve metadata value | ||
*/ | ||
extern int nr_php_csec_get_metadata(nr_php_csec_metadata_t*); | ||
typedef int (*nr_php_csec_get_metadata_t)(nr_php_csec_metadata_t*); | ||
extern int nr_php_csec_get_metadata(const nr_php_csec_metadata_key_t k, void** value); | ||
typedef int (*nr_php_csec_get_metadata_t)(const nr_php_csec_metadata_key_t k, void** value); | ||
#define NR_PHP_CSEC_GET_METADATA "nr_php_csec_get_metadata" | ||
#endif |