Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Network MIDI 2.0

Modules

 User Datagram Protocol for Universal MIDI Packets
 

Data Structures

struct  netmidi2_user
 A username/password pair for user-based authentication. More...
 
struct  netmidi2_userlist
 A list of users for user-based authentication. More...
 
struct  netmidi2_session
 A Network MIDI2 session, representing a connection to a peer. More...
 
struct  netmidi2_ep
 A Network MIDI2.0 Endpoint. More...
 

Macros

#define NETMIDI2_NONCE_SIZE   16
 Size, in bytes, of the nonce sent to the client for authentication.
 
#define NETMIDI2_EP_DEFINE(_var_name, _ep_name, _piid, _port)
 Statically declare a Network (UDP) MIDI 2.0 endpoint host.
 
#define NETMIDI2_EP_DEFINE_WITH_AUTH(_var_name, _ep_name, _piid, _port, _secret)
 Statically declare a Network (UDP) MIDI 2.0 endpoint host, with a predefined shared secret key for authentication.
 
#define NETMIDI2_EP_DEFINE_WITH_USERS(_var_name, _ep_name, _piid, _port, ...)
 Statically declare a Network (UDP) MIDI 2.0 endpoint host, with a predefined list of users/passwords for authentication.
 

Enumerations

enum  netmidi2_auth_type { NETMIDI2_AUTH_NONE , NETMIDI2_AUTH_SHARED_SECRET , NETMIDI2_AUTH_USER_PASSWORD }
 Type of authentication in Network MIDI2. More...
 

Functions

int netmidi2_host_ep_start (struct netmidi2_ep *ep)
 Start hosting a network (UDP) Universal MIDI Packet endpoint.
 
void netmidi2_broadcast (struct netmidi2_ep *ep, const struct midi_ump ump)
 Send a Universal MIDI Packet to all clients connected to the endpoint.
 
void netmidi2_send (struct netmidi2_session *sess, const struct midi_ump ump)
 Send a Universal MIDI Packet to a single client.
 

Detailed Description

Since
4.3
Version
0.1.0

Macro Definition Documentation

◆ NETMIDI2_EP_DEFINE

#define NETMIDI2_EP_DEFINE (   _var_name,
  _ep_name,
  _piid,
  _port 
)

#include <include/zephyr/net/midi2.h>

Value:
static struct netmidi2_ep _var_name = { \
.name = (_ep_name), \
.piid = (_piid), \
.addr4.sin_port = (_port), \
}
@ NETMIDI2_AUTH_NONE
No authentication required.
Definition midi2.h:195
A Network MIDI2.0 Endpoint.
Definition midi2.h:205
const char * name
The endpoint name.
Definition midi2.h:207
const char * piid
The endpoint product instance id.
Definition midi2.h:209
enum netmidi2_auth_type auth_type
The type of authentication required to establish a session with this host endpoint.
Definition midi2.h:226

Statically declare a Network (UDP) MIDI 2.0 endpoint host.

Parameters
_var_nameThe name of the variable holding the server data
_ep_nameThe UMP endpoint name
_piidThe UMP Product Instance ID. If NULL, HWINFO device ID will be used at runtime.
_portThe UDP port to listen to, or 0 for automatic assignment

◆ NETMIDI2_EP_DEFINE_WITH_AUTH

#define NETMIDI2_EP_DEFINE_WITH_AUTH (   _var_name,
  _ep_name,
  _piid,
  _port,
  _secret 
)

#include <include/zephyr/net/midi2.h>

Value:
static struct netmidi2_ep _var_name = { \
.name = (_ep_name), \
.piid = (_piid), \
.addr4.sin_port = (_port), \
.shared_auth_secret = (_secret), \
}
@ NETMIDI2_AUTH_SHARED_SECRET
Authentication with a shared secret key.
Definition midi2.h:197
const char * shared_auth_secret
A shared authentication key.
Definition midi2.h:230

Statically declare a Network (UDP) MIDI 2.0 endpoint host, with a predefined shared secret key for authentication.

Parameters
_var_nameThe name of the variable holding the server data
_ep_nameThe UMP endpoint name
_piidThe UMP Product Instance ID. If NULL, HWINFO device ID will be used at runtime.
_portThe UDP port to listen to, or 0 for automatic assignment
_secretThe shared secret key clients must provide to connect

◆ NETMIDI2_EP_DEFINE_WITH_USERS

#define NETMIDI2_EP_DEFINE_WITH_USERS (   _var_name,
  _ep_name,
  _piid,
  _port,
  ... 
)

#include <include/zephyr/net/midi2.h>

Value:
static const struct netmidi2_userlist users_of_##_var_name = { \
.n_users = ARRAY_SIZE(((struct netmidi2_user []) { __VA_ARGS__ })), \
.users = { __VA_ARGS__ }, \
}; \
static struct netmidi2_ep _var_name = { \
.name = (_ep_name), \
.piid = (_piid), \
.addr4.sin_port = (_port), \
.userlist = &users_of_##_var_name, \
}
@ NETMIDI2_AUTH_USER_PASSWORD
Authentication with username and password.
Definition midi2.h:199
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition util.h:118
const struct netmidi2_userlist * userlist
A list of users/passwords.
Definition midi2.h:232
A username/password pair for user-based authentication.
Definition midi2.h:112
A list of users for user-based authentication.
Definition midi2.h:122
size_t n_users
Number of users in the list.
Definition midi2.h:124

Statically declare a Network (UDP) MIDI 2.0 endpoint host, with a predefined list of users/passwords for authentication.

Parameters
_var_nameThe name of the variable holding the server data
_ep_nameThe UMP endpoint name
_piidThe UMP Product Instance ID. If NULL, HWINFO device ID will be used at runtime.
_portThe UDP port to listen to, or 0 for automatic assignment
...The username/password pairs (struct netmidi2_user)

Example usage:

NETMIDI2_EP_DEFINE_WITH_USERS(my_server, "endpoint", NULL, 0,
{.name="user1", .password="passwd1"},
{.name="user2", .password="passwd2"})
#define NETMIDI2_EP_DEFINE_WITH_USERS(_var_name, _ep_name, _piid, _port,...)
Statically declare a Network (UDP) MIDI 2.0 endpoint host, with a predefined list of users/passwords ...
Definition midi2.h:94
#define NULL
Definition iar_missing_defs.h:20

◆ NETMIDI2_NONCE_SIZE

#define NETMIDI2_NONCE_SIZE   16

#include <include/zephyr/net/midi2.h>

Size, in bytes, of the nonce sent to the client for authentication.

See also
User Datagram Protocol for Universal MIDI Packets: 6.7 Invitation Reply: Authentication Required

Enumeration Type Documentation

◆ netmidi2_auth_type

#include <include/zephyr/net/midi2.h>

Type of authentication in Network MIDI2.

Enumerator
NETMIDI2_AUTH_NONE 

No authentication required.

NETMIDI2_AUTH_SHARED_SECRET 

Authentication with a shared secret key.

NETMIDI2_AUTH_USER_PASSWORD 

Authentication with username and password.

Function Documentation

◆ netmidi2_broadcast()

void netmidi2_broadcast ( struct netmidi2_ep ep,
const struct midi_ump  ump 
)

#include <include/zephyr/net/midi2.h>

Send a Universal MIDI Packet to all clients connected to the endpoint.

Parameters
epThe endpoint
[in]umpThe packet to send

◆ netmidi2_host_ep_start()

int netmidi2_host_ep_start ( struct netmidi2_ep ep)

#include <include/zephyr/net/midi2.h>

Start hosting a network (UDP) Universal MIDI Packet endpoint.

Parameters
epThe network endpoint to start
Returns
0 on success, -errno on error

◆ netmidi2_send()

void netmidi2_send ( struct netmidi2_session sess,
const struct midi_ump  ump 
)

#include <include/zephyr/net/midi2.h>

Send a Universal MIDI Packet to a single client.

Parameters
sessThe session identifying the single client
[in]umpThe packet to send