forked from linux-nvme/nvme-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprivate-fabrics.h
More file actions
112 lines (95 loc) · 3.06 KB
/
private-fabrics.h
File metadata and controls
112 lines (95 loc) · 3.06 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
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* This file is part of libnvme.
* Copyright (c) 2026, Dell Technologies Inc. or its subsidiaries.
*
* Authors: Martin Belanger <[email protected]>
*/
#pragma once
#include <nvme/fabrics.h>
#include <nvme/tree.h>
#include "nvme/private.h"
struct libnvmf_context {
struct libnvme_global_ctx *ctx;
/* common callbacks */
bool (*decide_retry)(struct libnvmf_context *fctx, int err,
void *user_data);
void (*connected)(struct libnvmf_context *fctx, struct libnvme_ctrl *c,
void *user_data);
void (*already_connected)(struct libnvmf_context *fctx,
struct libnvme_host *host, const char *subsysnqn,
const char *transport, const char *traddr,
const char *trsvcid, void *user_data);
/* discovery callbacks */
void (*discovery_log)(struct libnvmf_context *fctx,
bool connect,
struct nvmf_discovery_log *log,
uint64_t numrec, void *user_data);
int (*parser_init)(struct libnvmf_context *fctx,
void *user_data);
void (*parser_cleanup)(struct libnvmf_context *fctx,
void *user_data);
int (*parser_next_line)(struct libnvmf_context *fctx,
void *user_data);
/* discovery defaults */
int default_max_discovery_retries;
int default_keep_alive_timeout;
/* common fabrics configuration */
const char *device;
bool persistent;
struct libnvme_fabrics_config cfg;
/* connection configuration */
const char *subsysnqn;
const char *transport;
const char *traddr;
const char *trsvcid;
const char *host_traddr;
const char *host_iface;
/* host configuration */
const char *hostnqn;
const char *hostid;
/* authentication and transport encryption configuration */
const char *hostkey;
const char *ctrlkey;
const char *keyring;
char *tls_key;
const char *tls_key_identity;
void *user_data;
};
/**
* NVMe-oF private struct definitions.
*
* Structs in this file are NVMe-oF-specific (fabrics layer). They are kept
* separate from private.h so that PCIe-only builds can exclude this entire
* file and its generated accessors (accessors-fabrics.{h,c}) along with the
* rest of the fabrics layer.
*/
struct libnvmf_discovery_args { // !generate-accessors !generate-lifecycle
int max_retries; // !default:6
__u8 lsp; // !default:NVMF_LOG_DISC_LSP_NONE
};
/**
* struct libnvmf_uri - Parsed URI structure
* @scheme: Scheme name (typically 'nvme')
* @protocol: Optional protocol/transport (e.g. 'tcp')
* @userinfo: Optional user information component of the URI authority
* @host: Host transport address
* @port: The port subcomponent or 0 if not specified
* @path_segments: NULL-terminated array of path segments
* @query: Optional query string component (separated by '?')
* @fragment: Optional fragment identifier component
* (separated by '#')
*/
struct libnvmf_uri { // !generate-accessors
char *scheme;
char *protocol;
char *userinfo;
char *host;
int port;
char **path_segments;
char *query;
char *fragment;
};
bool traddr_is_hostname(struct libnvme_global_ctx *ctx,
const char *transport, const char *traddr);
void libnvmf_default_config(struct libnvme_fabrics_config *cfg);