Skip to content

Commit

Permalink
feat: update link files
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 17, 2023
1 parent c525a18 commit b29b95f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
8 changes: 3 additions & 5 deletions src/link/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,11 @@ int8_t _z_link_send_wbuf(const _z_link_t *link, const _z_wbuf_t *wbf) {
int8_t ret = _Z_RES_OK;
_Bool link_is_streamed = false;

switch (link->_capabilities) {
case Z_LINK_CAP_UNICAST_STREAM:
case Z_LINK_CAP_MULTICAST_STREAM:
switch (link->_cap._flow) {
case Z_LINK_CAP_FLOW_STREAM:
link_is_streamed = true;
break;
case Z_LINK_CAP_UNICAST_DATAGRAM:
case Z_LINK_CAP_MULTICAST_DATAGRAM:
case Z_LINK_CAP_FLOW_DATAGRAM:
default:
link_is_streamed = false;
break;
Expand Down
6 changes: 4 additions & 2 deletions src/link/multicast/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ uint16_t _z_get_link_mtu_bt(void) { return SPP_MAXIMUM_PAYLOAD; }
int8_t _z_new_link_bt(_z_link_t *zl, _z_endpoint_t endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_MULTICAST_STREAM;
zl->_is_reliable = false;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_MULTICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_STREAM;
zl->_cap._is_reliable = false;

zl->_mtu = _z_get_link_mtu_bt();

zl->_endpoint = endpoint;
Expand Down
6 changes: 4 additions & 2 deletions src/link/multicast/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ uint16_t _z_get_link_mtu_udp_multicast(void) {
int8_t _z_new_link_udp_multicast(_z_link_t *zl, _z_endpoint_t endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_MULTICAST_DATAGRAM;
zl->_is_reliable = false;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_MULTICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_DATAGRAM;
zl->_cap._is_reliable = false;

zl->_mtu = _z_get_link_mtu_udp_multicast();

zl->_endpoint = endpoint;
Expand Down
6 changes: 4 additions & 2 deletions src/link/unicast/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ uint16_t _z_get_link_mtu_serial(void) { return _Z_SERIAL_MTU_SIZE; }
int8_t _z_new_link_serial(_z_link_t *zl, _z_endpoint_t endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_UNICAST_DATAGRAM;
zl->_is_reliable = false;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_UNICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_DATAGRAM;
zl->_cap._is_reliable = false;

zl->_mtu = _z_get_link_mtu_serial();

zl->_endpoint = endpoint;
Expand Down
6 changes: 4 additions & 2 deletions src/link/unicast/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ uint16_t _z_get_link_mtu_tcp(void) {
int8_t _z_new_link_tcp(_z_link_t *zl, _z_endpoint_t *endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_UNICAST_STREAM;
zl->_is_reliable = true;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_UNICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_STREAM;
zl->_cap._is_reliable = true;

zl->_mtu = _z_get_link_mtu_tcp();

zl->_endpoint = *endpoint;
Expand Down
6 changes: 4 additions & 2 deletions src/link/unicast/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ uint16_t _z_get_link_mtu_udp_unicast(void) {
int8_t _z_new_link_udp_unicast(_z_link_t *zl, _z_endpoint_t endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_UNICAST_DATAGRAM;
zl->_is_reliable = false;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_UNICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_DATAGRAM;
zl->_cap._is_reliable = false;

zl->_mtu = _z_get_link_mtu_udp_unicast();

zl->_endpoint = endpoint;
Expand Down
6 changes: 4 additions & 2 deletions src/link/unicast/ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ uint16_t _z_get_link_mtu_ws(void) {
int8_t _z_new_link_ws(_z_link_t *zl, _z_endpoint_t *endpoint) {
int8_t ret = _Z_RES_OK;

zl->_capabilities = Z_LINK_CAP_UNICAST_DATAGRAM;
zl->_is_reliable = true;
zl->_cap._transport = Z_LINK_CAP_TRANSPORT_UNICAST;
zl->_cap._flow = Z_LINK_CAP_FLOW_DATAGRAM;
zl->_cap._is_reliable = true;

zl->_mtu = _z_get_link_mtu_ws();

zl->_endpoint = *endpoint;
Expand Down

0 comments on commit b29b95f

Please sign in to comment.