Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
net_config.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright (c) 2017 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_NET_NET_CONFIG_H_
12#define ZEPHYR_INCLUDE_NET_NET_CONFIG_H_
13
14#include <zephyr/types.h>
15#include <zephyr/device.h>
16#include <zephyr/shell/shell.h>
17#include <zephyr/net/net_if.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
32
33/* Flags that tell what kind of functionality is needed by the client. */
39#define NET_CONFIG_NEED_ROUTER 0x00000001
40
45#define NET_CONFIG_NEED_IPV6 0x00000002
46
51#define NET_CONFIG_NEED_IPV4 0x00000004
52
66int net_config_init(const char *app_info, uint32_t flags, int32_t timeout);
67
83int net_config_init_by_iface(struct net_if *iface, const char *app_info,
84 uint32_t flags, int32_t timeout);
85
101int net_config_init_app(const struct device *dev, const char *app_info);
102
110 const char *username;
111
116 const char *password;
117};
118
127 const char *key_name;
128
133
139
144
149
154
159};
160
168#define NET_CONFIG_SSH_KEY_BUF_DEFINE_STATIC(name, key_bits) \
169 static uint8_t name[key_bits]
170
182#define NET_CONFIG_SSH_PASSWORD_AUTH_DEFINE_STATIC(name, user_name, pwd) \
183 static struct net_config_ssh_password_auth name = { \
184 .username = user_name, \
185 .password = pwd, \
186 }
187
205#define NET_CONFIG_SSH_PRIV_KEY_DEFINE_STATIC(name, \
206 _key_buf_name, \
207 _key_buf_len, \
208 _key_name, \
209 _key_id, \
210 _key_type, \
211 _key_bits) \
212 static struct net_config_ssh_key name = { \
213 .key_buf = _key_buf_name, \
214 .key_buf_len = _key_buf_len, \
215 .key_name = _key_name, \
216 .key_id = _key_id, \
217 .key_type = _key_type, \
218 .key_bits = _key_bits, \
219 .is_private = true, \
220 }
221
236#define NET_CONFIG_SSH_PUB_KEY_DEFINE_STATIC(name, \
237 _key_buf_name, \
238 _key_buf_len, \
239 _key_name, \
240 _key_id) \
241 static struct net_config_ssh_key name = { \
242 .key_buf = _key_buf_name, \
243 .key_buf_len = _key_buf_len, \
244 .key_name = _key_name, \
245 .key_id = _key_id, \
246 .key_bits = 0, \
247 .is_private = false, \
248 }
249
272#if defined(CONFIG_SSH_SERVER)
273int net_config_init_sshd(struct net_if *iface,
274 const struct net_config_ssh_key *priv_key_config,
275 const struct net_config_ssh_key *pub_key_config,
276 const struct net_config_ssh_password_auth *password_auth_config,
277 int sshd_instance);
278#else
279static inline int net_config_init_sshd(struct net_if *iface,
280 const struct net_config_ssh_key *priv_key_config,
281 const struct net_config_ssh_key *pub_key_config,
282 const struct net_config_ssh_password_auth *password_auth_config,
283 int sshd_instance)
284{
285 ARG_UNUSED(iface);
286 ARG_UNUSED(priv_key_config);
287 ARG_UNUSED(pub_key_config);
288 ARG_UNUSED(password_auth_config);
289 ARG_UNUSED(sshd_instance);
290
291 return -ENOTSUP;
292}
293#endif /* CONFIG_SSH_SERVER */
294
298
299#ifdef __cplusplus
300}
301#endif
302
303#endif /* ZEPHYR_INCLUDE_NET_NET_CONFIG_H_ */
int net_config_init(const char *app_info, uint32_t flags, int32_t timeout)
Initialize this network application.
int net_config_init_app(const struct device *dev, const char *app_info)
Initialize this network application.
static int net_config_init_sshd(struct net_if *iface, const struct net_config_ssh_key *priv_key_config, const struct net_config_ssh_key *pub_key_config, const struct net_config_ssh_password_auth *password_auth_config, int sshd_instance)
Initialize SSH server on the device.
Definition net_config.h:279
int net_config_init_by_iface(struct net_if *iface, const char *app_info, uint32_t flags, int32_t timeout)
Initialize this network application using a specific network interface.
ssh_host_key_type
Types of host keys that can be generated.
Definition keygen.h:29
#define ENOTSUP
Unsupported value.
Definition errno.h:114
SSH keygen API.
Public API for network interface.
flags
Definition parser.h:97
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
This contains key configuration data for sshd on the device.
Definition net_config.h:122
size_t key_buf_len
Size of the key buffer in bytes.
Definition net_config.h:138
bool is_private
Is private key?
Definition net_config.h:158
uint8_t * key_buf
Temp buffer for loading and saving keys.
Definition net_config.h:132
int key_id
Key id.
Definition net_config.h:143
int key_bits
Key size in bits.
Definition net_config.h:153
enum ssh_host_key_type key_type
Key type.
Definition net_config.h:148
const char * key_name
SSH key name.
Definition net_config.h:127
This contains configuration data for password authentication for sshd on the device.
Definition net_config.h:106
const char * password
Password to use for password authentication.
Definition net_config.h:116
const char * username
Username to use for password authentication.
Definition net_config.h:110
Network Interface structure.
Definition net_if.h:735