Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
bt_l2cap_server Struct Reference

L2CAP Server structure. More...

#include <l2cap.h>

Data Fields

uint16_t psm
 Server PSM.
bt_security_t sec_level
 Required minimum security level.
int(* accept )(struct bt_conn *conn, struct bt_l2cap_server *server, struct bt_l2cap_chan **chan)
 Server accept callback.
sys_snode_t node

Detailed Description

L2CAP Server structure.

Field Documentation

◆ accept

int(* bt_l2cap_server::accept) (struct bt_conn *conn, struct bt_l2cap_server *server, struct bt_l2cap_chan **chan)

Server accept callback.

This callback is called whenever a new incoming connection requires authorization. If accepting the connection, the callback is expected to allocate a zero-initialized channel object and update the channel reference chan to point to its common member: for a server registered with bt_l2cap_server_register() the object must be of type bt_l2cap_le_chan and chan set to its bt_l2cap_le_chan::chan member, and for a server registered with bt_l2cap_br_server_register() the object must be of type bt_l2cap_br_chan and chan set to its bt_l2cap_br_chan::chan member.

Warning
Even though the reference passed back through chan is a bt_l2cap_chan, it must be a member of a bt_l2cap_le_chan or bt_l2cap_br_chan object as described above. The stack uses the containing object, so returning a bare bt_l2cap_chan would result in out-of-bounds access. It is the responsibility of this callback to zero out the containing object.
Parameters
connThe connection that is requesting authorization
serverPointer to the server structure this callback relates to
chanPointer to received the allocated channel
Returns
0 in case of success or negative value in case of error.
-ENOMEM if no available space for new channel.
-EACCES if application did not authorize the connection.
-EPERM if encryption key size is too short.

◆ node

sys_snode_t bt_l2cap_server::node

◆ psm

uint16_t bt_l2cap_server::psm

Server PSM.

For LE, possible values: 0 A dynamic value will be auto-allocated when bt_l2cap_server_register() is called.

0x0001-0x007f Standard, Bluetooth SIG-assigned fixed values.

0x0080-0x00ff Dynamically allocated. May be pre-set by the application before server registration (not recommended however), or auto-allocated by the stack if the app gave 0 as the value.

For BR, possible values:

The PSM field is at least two octets in length. All PSM values shall have the least significant bit of the most significant octet equal to 0 and the least significant bit of all other octets equal to 1.

0 A dynamic value will be auto-allocated when bt_l2cap_br_server_register() is called.

0x0001-0x0eff Standard, Bluetooth SIG-assigned fixed values.

0x1000 Dynamically allocated. May be pre-set by the application before server registration (not recommended however), or auto-allocated by the stack if the app gave 0 as the value.

◆ sec_level

bt_security_t bt_l2cap_server::sec_level

Required minimum security level.


The documentation for this struct was generated from the following file: