6#ifndef ZEPHYR_INCLUDE_NET_MIDI2_H_
7#define ZEPHYR_INCLUDE_NET_MIDI2_H_
39#define NETMIDI2_NONCE_SIZE 16
49#define NETMIDI2_EP_DEFINE(_var_name, _ep_name, _piid, _port) \
50 static struct netmidi2_ep _var_name = { \
53 .addr4.sin_port = (_port), \
54 .auth_type = NETMIDI2_AUTH_NONE, \
67#define NETMIDI2_EP_DEFINE_WITH_AUTH(_var_name, _ep_name, _piid, _port, _secret) \
68 static struct netmidi2_ep _var_name = { \
71 .addr4.sin_port = (_port), \
72 .auth_type = NETMIDI2_AUTH_SHARED_SECRET, \
73 .shared_auth_secret = (_secret), \
93#define NETMIDI2_EP_DEFINE_WITH_USERS(_var_name, _ep_name, _piid, _port, ...) \
94 static const struct netmidi2_userlist users_of_##_var_name = { \
95 .n_users = ARRAY_SIZE(((struct netmidi2_user []) { __VA_ARGS__ })), \
96 .users = { __VA_ARGS__ }, \
98 static struct netmidi2_ep _var_name = { \
101 .addr4.sin_port = (_port), \
102 .auth_type = NETMIDI2_AUTH_USER_PASSWORD, \
103 .userlist = &users_of_##_var_name, \
172 struct net_sockaddr_storage
addr;
177#if defined(CONFIG_NETMIDI2_HOST_AUTH) || defined(__DOXYGEN__)
226#if defined(CONFIG_NETMIDI2_HOST_AUTH) || defined(__DOXYGEN__)
uint32_t net_socklen_t
Length of a socket address.
Definition net_ip.h:171
void netmidi2_send(struct netmidi2_session *sess, const struct midi_ump ump)
Send a Universal MIDI Packet to a single client.
void netmidi2_broadcast(struct netmidi2_ep *ep, const struct midi_ump ump)
Send a Universal MIDI Packet to all clients connected to the endpoint.
#define NETMIDI2_NONCE_SIZE
Size, in bytes, of the nonce sent to the client for authentication.
Definition midi2.h:39
int netmidi2_host_ep_start(struct netmidi2_ep *ep)
Start hosting a network (UDP) Universal MIDI Packet endpoint.
netmidi2_auth_type
Type of authentication in Network MIDI2.
Definition midi2.h:192
@ NETMIDI2_AUTH_SHARED_SECRET
Authentication with a shared secret key.
Definition midi2.h:196
@ NETMIDI2_AUTH_USER_PASSWORD
Authentication with username and password.
Definition midi2.h:198
@ NETMIDI2_AUTH_NONE
No authentication required.
Definition midi2.h:194
BSD Sockets compatible API definitions.
state
Definition parser_state.h:29
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
A structure used to submit work.
Definition kernel.h:4335
Universal MIDI Packet container.
Definition midi.h:41
Network buffer representation.
Definition net_buf.h:1006
Socket address struct for IPv6.
Definition net_ip.h:179
Socket address struct for IPv4.
Definition net_ip.h:187
Generic sockaddr struct.
Definition net_ip.h:408
A Network MIDI2.0 Endpoint.
Definition midi2.h:204
const struct netmidi2_userlist * userlist
A list of users/passwords.
Definition midi2.h:231
struct net_sockaddr addr
Definition midi2.h:211
struct net_sockaddr_in addr4
Definition midi2.h:212
const char * name
The endpoint name.
Definition midi2.h:206
struct net_sockaddr_in6 addr6
Definition midi2.h:213
const char * shared_auth_secret
A shared authentication key.
Definition midi2.h:229
struct zsock_pollfd pollsock
The listening socket wrapped in a poll descriptor.
Definition midi2.h:216
void(* rx_packet_cb)(struct netmidi2_session *session, const struct midi_ump ump)
The function to call when data is received from a client.
Definition midi2.h:218
const char * piid
The endpoint product instance id.
Definition midi2.h:208
struct netmidi2_session peers[CONFIG_NETMIDI2_HOST_MAX_CLIENTS]
List of peers to this endpoint.
Definition midi2.h:221
enum netmidi2_auth_type auth_type
The type of authentication required to establish a session with this host endpoint.
Definition midi2.h:225
A Network MIDI2 session, representing a connection to a peer.
Definition midi2.h:131
const struct netmidi2_user * user
The username to which this session belongs.
Definition midi2.h:179
@ NETMIDI2_SESSION_PENDING_INVITATION
Client has sent Invitation, however the Host has not accepted the Invitation.
Definition midi2.h:148
@ NETMIDI2_SESSION_PENDING_RESET
One Device has sent the Session Reset Command and is waiting for Session Reset Reply,...
Definition midi2.h:161
@ NETMIDI2_SESSION_AUTH_REQUIRED
Host has replied with Invitation Reply: Authentication Required or Invitation Reply: User Authenticat...
Definition midi2.h:154
@ NETMIDI2_SESSION_NOT_INITIALIZED
The session is not in use.
Definition midi2.h:138
@ NETMIDI2_SESSION_IDLE
Device may be aware of each other (e.g.
Definition midi2.h:143
@ NETMIDI2_SESSION_PENDING_BYE
one Endpoint has sent Bye and is waiting for Bye Reply, and a timeout has not yet occurred.
Definition midi2.h:165
@ NETMIDI2_SESSION_ESTABLISHED
Invitation accepted, UMP Commands can be exchanged.
Definition midi2.h:156
struct net_buf * tx_buf
The transmission buffer for that peer.
Definition midi2.h:184
struct k_work tx_work
The transmission work for that peer.
Definition midi2.h:186
net_socklen_t addr_len
Length of the peer's remote address.
Definition midi2.h:174
uint16_t tx_ump_seq
Sequence number of the next universal MIDI packet to send.
Definition midi2.h:168
struct net_sockaddr_storage addr
Remote address of the peer.
Definition midi2.h:172
char nonce[16]
The crypto nonce used to authorize this session.
Definition midi2.h:181
struct netmidi2_ep * ep
The Network MIDI2 endpoint to which this session belongs.
Definition midi2.h:176
uint16_t rx_ump_seq
Sequence number of the next universal MIDI packet to receive.
Definition midi2.h:170
A username/password pair for user-based authentication.
Definition midi2.h:111
const char * name
The user name for authentication.
Definition midi2.h:113
const char * password
The password for authentication.
Definition midi2.h:115
A list of users for user-based authentication.
Definition midi2.h:121
size_t n_users
Number of users in the list.
Definition midi2.h:123
const struct netmidi2_user users[]
The user/password pairs.
Definition midi2.h:125
Definition of the monitored socket/file descriptor.
Definition socket_poll.h:31