OCPF context API.
More...
#include "libocpf/ocpf.h"
|
struct ocpf_context * | ocpf_context_add (struct ocpf *ocpf_ctx, const char *filename, uint32_t *context_id, uint8_t flags, bool *existing) |
|
int | ocpf_context_delete (struct ocpf *ocpf_ctx, struct ocpf_context *ctx) |
|
stat h stat h struct ocpf_context * | ocpf_context_init (TALLOC_CTX *mem_ctx, const char *filename, uint8_t flags, uint32_t context_id) |
|
struct ocpf_context * | ocpf_context_search_by_context_id (struct ocpf_context *ctx, uint32_t context_id) |
|
struct ocpf_context * | ocpf_context_search_by_filename (struct ocpf_context *ctx, const char *filename) |
|
◆ ocpf_context_add()
struct ocpf_context* ocpf_context_add |
( |
struct ocpf * |
ocpf_ctx, |
|
|
const char * |
filename, |
|
|
uint32_t * |
context_id, |
|
|
uint8_t |
flags, |
|
|
bool * |
existing |
|
) |
| |
Add an OCPF context to the list
- Parameters
-
ocpf_ctx | pointer to the global ocpf context |
filename | pointer to the |
context_id | pointer to the context_id the function returns |
flags | Flags controlling how the OCPF should be opened |
existing | boolean returned by the function to specify if the context was already existing or not |
- Returns
- valid ocpf context pointer on success, otherwise NULL
◆ ocpf_context_delete()
int ocpf_context_delete |
( |
struct ocpf * |
ocpf_ctx, |
|
|
struct ocpf_context * |
ctx |
|
) |
| |
Delete an OCPF context
- Parameters
-
ocpf_ctx | pointer to the global ocpf context |
ctx | pointer to the OCPF context to delete |
- Returns
- 0 on success, 1 if there were still a ref_count, otherwise -1 on errors.
◆ ocpf_context_init()
stat h stat h struct ocpf_context* ocpf_context_init |
( |
TALLOC_CTX * |
mem_ctx, |
|
|
const char * |
filename, |
|
|
uint8_t |
flags, |
|
|
uint32_t |
context_id |
|
) |
| |
Initialize a new OCPF context
- Parameters
-
mem_ctx | pointer to the memory context |
filename | the OCPF filename used for this context |
flags | Flags controlling how the OCPF should be opened |
context_id | the identifier representing the context |
context_id | the context identifier to use for this context |
- Returns
- new allocated OCPF context on success, otherwise NULL
◆ ocpf_context_search_by_context_id()
struct ocpf_context* ocpf_context_search_by_context_id |
( |
struct ocpf_context * |
ctx, |
|
|
uint32_t |
context_id |
|
) |
| |
◆ ocpf_context_search_by_filename()
struct ocpf_context* ocpf_context_search_by_filename |
( |
struct ocpf_context * |
ctx, |
|
|
const char * |
filename |
|
) |
| |
Search a context given its filename
- Parameters
-
ctx | pointer to the ocpf context list |
filename | the filename to use for search |
- Returns
- pointer to valid ocpf context on success, otherwise NULL