Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <libsbp/v4/sbas.h>
#include <libsbp/v4/sbp_msg.h>
#include <libsbp/v4/settings.h>
#include <libsbp/v4/signing.h>
#include <libsbp/v4/solution_meta.h>
#include <libsbp/v4/ssr.h>
#include <libsbp/v4/system.h>
Expand Down Expand Up @@ -1331,6 +1332,77 @@ struct MessageTraits<sbp_msg_dops_t> {
}
};

template <>
struct MessageTraits<sbp_msg_ed25519_certificate_t> {
static constexpr sbp_msg_type_t id = SbpMsgEd25519Certificate;
static const sbp_msg_ed25519_certificate_t &get(const sbp_msg_t &msg) {
return msg.ed25519_certificate;
}
static sbp_msg_ed25519_certificate_t &get(sbp_msg_t &msg) {
return msg.ed25519_certificate;
}
static void to_sbp_msg(const sbp_msg_ed25519_certificate_t &msg,
sbp_msg_t *sbp_msg) {
sbp_msg->ed25519_certificate = msg;
}
static sbp_msg_t to_sbp_msg(const sbp_msg_ed25519_certificate_t &msg) {
sbp_msg_t sbp_msg;
sbp_msg.ed25519_certificate = msg;
return sbp_msg;
}
static s8 send(sbp_state_t *state, u16 sender_id,
const sbp_msg_ed25519_certificate_t &msg,
sbp_write_fn_t write) {
return sbp_msg_ed25519_certificate_send(state, sender_id, &msg, write);
}
static s8 encode(uint8_t *buf, uint8_t len, uint8_t *n_written,
const sbp_msg_ed25519_certificate_t &msg) {
return sbp_msg_ed25519_certificate_encode(buf, len, n_written, &msg);
}
static s8 decode(const uint8_t *buf, uint8_t len, uint8_t *n_read,
sbp_msg_ed25519_certificate_t *msg) {
return sbp_msg_ed25519_certificate_decode(buf, len, n_read, msg);
}
static size_t encoded_len(const sbp_msg_ed25519_certificate_t &msg) {
return sbp_msg_ed25519_certificate_encoded_len(&msg);
}
};

template <>
struct MessageTraits<sbp_msg_ed25519_signature_t> {
static constexpr sbp_msg_type_t id = SbpMsgEd25519Signature;
static const sbp_msg_ed25519_signature_t &get(const sbp_msg_t &msg) {
return msg.ed25519_signature;
}
static sbp_msg_ed25519_signature_t &get(sbp_msg_t &msg) {
return msg.ed25519_signature;
}
static void to_sbp_msg(const sbp_msg_ed25519_signature_t &msg,
sbp_msg_t *sbp_msg) {
sbp_msg->ed25519_signature = msg;
}
static sbp_msg_t to_sbp_msg(const sbp_msg_ed25519_signature_t &msg) {
sbp_msg_t sbp_msg;
sbp_msg.ed25519_signature = msg;
return sbp_msg;
}
static s8 send(sbp_state_t *state, u16 sender_id,
const sbp_msg_ed25519_signature_t &msg, sbp_write_fn_t write) {
return sbp_msg_ed25519_signature_send(state, sender_id, &msg, write);
}
static s8 encode(uint8_t *buf, uint8_t len, uint8_t *n_written,
const sbp_msg_ed25519_signature_t &msg) {
return sbp_msg_ed25519_signature_encode(buf, len, n_written, &msg);
}
static s8 decode(const uint8_t *buf, uint8_t len, uint8_t *n_read,
sbp_msg_ed25519_signature_t *msg) {
return sbp_msg_ed25519_signature_decode(buf, len, n_read, msg);
}
static size_t encoded_len(const sbp_msg_ed25519_signature_t &msg) {
return sbp_msg_ed25519_signature_encoded_len(&msg);
}
};

template <>
struct MessageTraits<sbp_msg_ephemeris_bds_t> {
static constexpr sbp_msg_type_t id = SbpMsgEphemerisBds;
Expand Down
13 changes: 13 additions & 0 deletions c/include/libsbp/legacy/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <libsbp/legacy/piksi.h>
#include <libsbp/legacy/sbas.h>
#include <libsbp/legacy/settings.h>
#include <libsbp/legacy/signing.h>
#include <libsbp/legacy/solution_meta.h>
#include <libsbp/legacy/ssr.h>
#include <libsbp/legacy/system.h>
Expand Down Expand Up @@ -1129,6 +1130,18 @@ struct MessageTraits<msg_ssr_flag_iono_grid_point_sat_los_t> {
};


template<>
struct MessageTraits<msg_ed25519_signature_t> {
static constexpr u16 id = 3073;
};


template<>
struct MessageTraits<msg_ed25519_certificate_t> {
static constexpr u16 id = 3074;
};


template<>
struct MessageTraits<msg_fileio_config_req_t> {
static constexpr u16 id = 4097;
Expand Down
45 changes: 45 additions & 0 deletions c/include/libsbp/legacy/signing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2015-2021 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

/*****************************************************************************
* Automatically generated from yaml/swiftnav/sbp/signing.yaml
* with generate.py. Please do not hand edit!
*****************************************************************************/

/** \defgroup signing Signing
*
* Messages relating to signatures
* \{ */

#ifndef LIBSBP_LEGACY_SIGNING_MESSAGES_H
#define LIBSBP_LEGACY_SIGNING_MESSAGES_H

#include <libsbp/common.h>

#include <libsbp/legacy/gnss.h>
#include <libsbp/signing_macros.h>

SBP_PACK_START

typedef struct SBP_ATTR_PACKED {
u8 stub[0];
} msg_ed25519_signature_t;

typedef struct SBP_ATTR_PACKED {
u8 stub[0];
} msg_ed25519_certificate_t;

/** \} */

SBP_PACK_END

#endif /* LIBSBP_LEGACY_SIGNING_MESSAGES_H */
3 changes: 3 additions & 0 deletions c/include/libsbp/sbp_msg_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <libsbp/piksi_macros.h>
#include <libsbp/sbas_macros.h>
#include <libsbp/settings_macros.h>
#include <libsbp/signing_macros.h>
#include <libsbp/solution_meta_macros.h>
#include <libsbp/ssr_macros.h>
#include <libsbp/system_macros.h>
Expand Down Expand Up @@ -88,6 +89,8 @@ typedef enum {
SbpMsgDgnssStatus = SBP_MSG_DGNSS_STATUS,
SbpMsgDopsDepA = SBP_MSG_DOPS_DEP_A,
SbpMsgDops = SBP_MSG_DOPS,
SbpMsgEd25519Certificate = SBP_MSG_ED25519_CERTIFICATE,
SbpMsgEd25519Signature = SBP_MSG_ED25519_SIGNATURE,
SbpMsgEphemerisBds = SBP_MSG_EPHEMERIS_BDS,
SbpMsgEphemerisDepA = SBP_MSG_EPHEMERIS_DEP_A,
SbpMsgEphemerisDepB = SBP_MSG_EPHEMERIS_DEP_B,
Expand Down
30 changes: 30 additions & 0 deletions c/include/libsbp/signing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2015-2021 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

/*****************************************************************************
* Automatically generated from yaml/swiftnav/sbp/signing.yaml
* with generate.py. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_SIGNING_MESSAGES_H
#define LIBSBP_SIGNING_MESSAGES_H

#include <libsbp/common.h>

SBP_MESSAGE(
"Legacy SBP definitions have moved. To continue using legacy message "
"definitions include `libsbp/legacy/signing.h` instead. Access to legacy "
"types via `libsbp/signing.h` will be removed in version 5.")

#include <libsbp/legacy/signing.h>

#endif /* LIBSBP_SIGNING_MESSAGES_H */
68 changes: 68 additions & 0 deletions c/include/libsbp/signing_macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2015-2021 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

/*****************************************************************************
* Automatically generated from yaml/swiftnav/sbp/signing.yaml
* with generate.py. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_SIGNING_MACROS_H
#define LIBSBP_SIGNING_MACROS_H

#define SBP_MSG_ED25519_SIGNATURE 0x0C01
/**
* The maximum number of items that can be stored in
* sbp_msg_ed25519_signature_t::stub (V4 API) or msg_ed25519_signature_t::stub
* (legacy API) before the maximum SBP message size is exceeded
*/
#define SBP_MSG_ED25519_SIGNATURE_STUB_MAX 255u

/**
* Encoded length of sbp_msg_ed25519_signature_t (V4 API) and
* msg_ed25519_signature_t (legacy API)
*
* This type is not fixed size and an instance of this message may be longer
* than the value indicated by this symbol. Users of the V4 API should call
* #sbp_msg_ed25519_signature_encoded_len to determine the actual size of an
* instance of this message. Users of the legacy API are required to track the
* encoded message length when interacting with the legacy type.
*
* See the documentation for libsbp for more details regarding the message
* structure and its variable length component(s)
*/
#define SBP_MSG_ED25519_SIGNATURE_ENCODED_OVERHEAD 0u

#define SBP_MSG_ED25519_CERTIFICATE 0x0C02
/**
* The maximum number of items that can be stored in
* sbp_msg_ed25519_certificate_t::stub (V4 API) or
* msg_ed25519_certificate_t::stub (legacy API) before the maximum SBP message
* size is exceeded
*/
#define SBP_MSG_ED25519_CERTIFICATE_STUB_MAX 255u

/**
* Encoded length of sbp_msg_ed25519_certificate_t (V4 API) and
* msg_ed25519_certificate_t (legacy API)
*
* This type is not fixed size and an instance of this message may be longer
* than the value indicated by this symbol. Users of the V4 API should call
* #sbp_msg_ed25519_certificate_encoded_len to determine the actual size of an
* instance of this message. Users of the legacy API are required to track the
* encoded message length when interacting with the legacy type.
*
* See the documentation for libsbp for more details regarding the message
* structure and its variable length component(s)
*/
#define SBP_MSG_ED25519_CERTIFICATE_ENCODED_OVERHEAD 0u

#endif /* LIBSBP_SIGNING_MACROS_H */
25 changes: 25 additions & 0 deletions c/include/libsbp/v4/sbp_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <libsbp/v4/piksi.h>
#include <libsbp/v4/sbas.h>
#include <libsbp/v4/settings.h>
#include <libsbp/v4/signing.h>
#include <libsbp/v4/solution_meta.h>
#include <libsbp/v4/ssr.h>
#include <libsbp/v4/system.h>
Expand Down Expand Up @@ -94,6 +95,8 @@ typedef union {
sbp_msg_dgnss_status_t dgnss_status;
sbp_msg_dops_dep_a_t dops_dep_a;
sbp_msg_dops_t dops;
sbp_msg_ed25519_certificate_t ed25519_certificate;
sbp_msg_ed25519_signature_t ed25519_signature;
sbp_msg_ephemeris_bds_t ephemeris_bds;
sbp_msg_ephemeris_dep_a_t ephemeris_dep_a;
sbp_msg_ephemeris_dep_b_t ephemeris_dep_b;
Expand Down Expand Up @@ -398,6 +401,12 @@ static inline s8 sbp_message_encode(uint8_t *buf, uint8_t len,
return sbp_msg_dops_dep_a_encode(buf, len, n_written, &msg->dops_dep_a);
case SbpMsgDops:
return sbp_msg_dops_encode(buf, len, n_written, &msg->dops);
case SbpMsgEd25519Certificate:
return sbp_msg_ed25519_certificate_encode(buf, len, n_written,
&msg->ed25519_certificate);
case SbpMsgEd25519Signature:
return sbp_msg_ed25519_signature_encode(buf, len, n_written,
&msg->ed25519_signature);
case SbpMsgEphemerisBds:
return sbp_msg_ephemeris_bds_encode(buf, len, n_written,
&msg->ephemeris_bds);
Expand Down Expand Up @@ -1013,6 +1022,12 @@ static inline s8 sbp_message_decode(const uint8_t *buf, uint8_t len,
return sbp_msg_dops_dep_a_decode(buf, len, n_read, &msg->dops_dep_a);
case SbpMsgDops:
return sbp_msg_dops_decode(buf, len, n_read, &msg->dops);
case SbpMsgEd25519Certificate:
return sbp_msg_ed25519_certificate_decode(buf, len, n_read,
&msg->ed25519_certificate);
case SbpMsgEd25519Signature:
return sbp_msg_ed25519_signature_decode(buf, len, n_read,
&msg->ed25519_signature);
case SbpMsgEphemerisBds:
return sbp_msg_ephemeris_bds_decode(buf, len, n_read,
&msg->ephemeris_bds);
Expand Down Expand Up @@ -1600,6 +1615,10 @@ static inline size_t sbp_message_encoded_len(sbp_msg_type_t msg_type,
return sbp_msg_dops_dep_a_encoded_len(&msg->dops_dep_a);
case SbpMsgDops:
return sbp_msg_dops_encoded_len(&msg->dops);
case SbpMsgEd25519Certificate:
return sbp_msg_ed25519_certificate_encoded_len(&msg->ed25519_certificate);
case SbpMsgEd25519Signature:
return sbp_msg_ed25519_signature_encoded_len(&msg->ed25519_signature);
case SbpMsgEphemerisBds:
return sbp_msg_ephemeris_bds_encoded_len(&msg->ephemeris_bds);
case SbpMsgEphemerisDepA:
Expand Down Expand Up @@ -2116,6 +2135,12 @@ static inline int sbp_message_cmp(sbp_msg_type_t msg_type, const sbp_msg_t *a,
return sbp_msg_dops_dep_a_cmp(&a->dops_dep_a, &b->dops_dep_a);
case SbpMsgDops:
return sbp_msg_dops_cmp(&a->dops, &b->dops);
case SbpMsgEd25519Certificate:
return sbp_msg_ed25519_certificate_cmp(&a->ed25519_certificate,
&b->ed25519_certificate);
case SbpMsgEd25519Signature:
return sbp_msg_ed25519_signature_cmp(&a->ed25519_signature,
&b->ed25519_signature);
case SbpMsgEphemerisBds:
return sbp_msg_ephemeris_bds_cmp(&a->ephemeris_bds, &b->ephemeris_bds);
case SbpMsgEphemerisDepA:
Expand Down
23 changes: 23 additions & 0 deletions c/include/libsbp/v4/signing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2015-2021 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

/*****************************************************************************
* Automatically generated from yaml/swiftnav/sbp/signing.yaml
* with generate.py. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_V4_SIGNING_MESSAGES_H
#define LIBSBP_V4_SIGNING_MESSAGES_H
#include <libsbp/v4/signing/MSG_ED25519_CERTIFICATE.h>
#include <libsbp/v4/signing/MSG_ED25519_SIGNATURE.h>

#endif /* LIBSBP_V4_SIGNING_MESSAGES_H */
Loading