libosdp 3.2.6__tar.gz → 3.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libosdp-3.2.6 → libosdp-3.2.7}/PKG-INFO +1 -1
- {libosdp-3.2.6 → libosdp-3.2.7}/libosdp.egg-info/PKG-INFO +1 -1
- {libosdp-3.2.6 → libosdp-3.2.7}/setup.py +1 -1
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_common.c +5 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_common.h +2 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_config.h +3 -3
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_cp.c +21 -1
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_phy.c +24 -2
- {libosdp-3.2.6 → libosdp-3.2.7}/MANIFEST.in +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/README.md +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/libosdp.egg-info/SOURCES.txt +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/libosdp.egg-info/dependency_links.txt +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/libosdp.egg-info/top_level.txt +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/__init__.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/channel.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/constants.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/control_panel.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/helpers.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/key_store.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/osdp/peripheral_device.py +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/pyproject.toml +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/setup.cfg +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/include/osdp.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/include/osdp_export.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/base.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/cp.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/data.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/module.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/module.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/pd.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/python/osdp_sys/utils.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/crypto/tinyaes.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/crypto/tinyaes_src.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/crypto/tinyaes_src.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_diag.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_diag.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_file.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_file.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_pd.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/src/osdp_sc.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/assert.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/crc16.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/disjoint_set.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/list.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/logger.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/pcap_gen.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/queue.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/slab.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/include/utils/utils.h +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/crc16.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/disjoint_set.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/list.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/logger.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/pcap_gen.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/queue.c +0 -0
- {libosdp-3.2.6 → libosdp-3.2.7}/vendor/utils/src/utils.c +0 -0
|
@@ -174,6 +174,11 @@ int osdp_rb_pop_buf(struct osdp_rb *p, uint8_t *buf, int max_len)
|
|
|
174
174
|
return i;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
void osdp_rb_reset(struct osdp_rb *p)
|
|
178
|
+
{
|
|
179
|
+
p->head = p->tail = 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
/* --- Exported Methods --- */
|
|
178
183
|
|
|
179
184
|
void osdp_logger_init(const char *name, int log_level,
|
|
@@ -372,6 +372,7 @@ struct osdp_pd {
|
|
|
372
372
|
int state; /* FSM state (CP mode only) */
|
|
373
373
|
int phy_state; /* phy layer FSM state (CP mode only) */
|
|
374
374
|
int phy_retry_count; /* command retry counter */
|
|
375
|
+
int phy_tx_seq; /* seq number embedded in last TX packet */
|
|
375
376
|
uint32_t wait_ms; /* wait time in MS to retry communication */
|
|
376
377
|
int64_t tstamp; /* Last POLL command issued time in ticks */
|
|
377
378
|
int64_t sc_tstamp; /* Last received secure reply time in ticks */
|
|
@@ -466,6 +467,7 @@ int osdp_rb_push(struct osdp_rb *p, uint8_t data);
|
|
|
466
467
|
int osdp_rb_push_buf(struct osdp_rb *p, uint8_t *buf, int len);
|
|
467
468
|
int osdp_rb_pop(struct osdp_rb *p, uint8_t *data);
|
|
468
469
|
int osdp_rb_pop_buf(struct osdp_rb *p, uint8_t *buf, int max_len);
|
|
470
|
+
void osdp_rb_reset(struct osdp_rb *p);
|
|
469
471
|
|
|
470
472
|
void osdp_crypt_setup();
|
|
471
473
|
void osdp_encrypt(uint8_t *key, uint8_t *iv, uint8_t *data, int len);
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
* @brief The following macros are defined defined from the variable in cmake
|
|
12
12
|
* files. All @XXX@ are replaced by the value of XXX as resolved by cmake.
|
|
13
13
|
*/
|
|
14
|
-
#define PROJECT_VERSION "3.2.
|
|
14
|
+
#define PROJECT_VERSION "3.2.7"
|
|
15
15
|
#define PROJECT_NAME "libosdp"
|
|
16
16
|
#define GIT_BRANCH "detached"
|
|
17
|
-
#define GIT_REV "v3.2.
|
|
18
|
-
#define GIT_TAG "v3.2.
|
|
17
|
+
#define GIT_REV "v3.2.7-0-gb284aa2"
|
|
18
|
+
#define GIT_TAG "v3.2.7"
|
|
19
19
|
#define GIT_DIFF ""
|
|
20
20
|
#define REPO_ROOT "/home/runner/work/libosdp/libosdp"
|
|
21
21
|
|
|
@@ -744,6 +744,21 @@ static int cp_process_reply(struct osdp_pd *pd)
|
|
|
744
744
|
return OSDP_CP_ERR_NO_DATA;
|
|
745
745
|
case OSDP_ERR_PKT_BUSY:
|
|
746
746
|
return OSDP_CP_ERR_RETRY_CMD;
|
|
747
|
+
case OSDP_ERR_PKT_SKIP: {
|
|
748
|
+
/*
|
|
749
|
+
* A command-direction frame reached us: either a second CP is
|
|
750
|
+
* contending for the bus or we heard our own transmission echo
|
|
751
|
+
* back. Drop the frame and keep waiting for the real reply.
|
|
752
|
+
* The buffered header must be discarded or phy_check_header()
|
|
753
|
+
* re-validates it forever, but osdp_phy_state_reset() also
|
|
754
|
+
* clears phy_state, which the CP owns; preserve it.
|
|
755
|
+
*/
|
|
756
|
+
int saved_phy_state = pd->phy_state;
|
|
757
|
+
|
|
758
|
+
osdp_phy_state_reset(pd, false);
|
|
759
|
+
pd->phy_state = saved_phy_state;
|
|
760
|
+
return OSDP_CP_ERR_NO_DATA;
|
|
761
|
+
}
|
|
747
762
|
case OSDP_ERR_PKT_NACK:
|
|
748
763
|
if (pd->ephemeral_data[0] == OSDP_PD_NAK_SEQ_NUM) {
|
|
749
764
|
LOG_WRN("NAK(SEQ_NUM); restarting communication");
|
|
@@ -878,7 +893,12 @@ static int cp_phy_state_update(struct osdp_pd *pd)
|
|
|
878
893
|
pd->phy_state = OSDP_CP_PHY_STATE_SEND_CMD;
|
|
879
894
|
__fallthrough;
|
|
880
895
|
case OSDP_CP_PHY_STATE_SEND_CMD:
|
|
881
|
-
|
|
896
|
+
if (pd->phy_retry_count > 0) {
|
|
897
|
+
struct osdp_channel *channel = &pd->channel;
|
|
898
|
+
if (channel->flush)
|
|
899
|
+
channel->flush(channel->data);
|
|
900
|
+
pd->seq_number = pd->phy_tx_seq - 1;
|
|
901
|
+
}
|
|
882
902
|
if (cp_build_and_send_packet(pd)) {
|
|
883
903
|
LOG_ERR("Failed to build/send packet for CMD: %s(%02x)",
|
|
884
904
|
osdp_cmd_name(pd->cmd_id), pd->cmd_id);
|
|
@@ -230,6 +230,7 @@ int osdp_phy_packet_init(struct osdp_pd *pd, uint8_t *buf, int max_len)
|
|
|
230
230
|
id = pd->cmd_id;
|
|
231
231
|
}
|
|
232
232
|
pkt->control = phy_get_next_seq_number(pd);
|
|
233
|
+
pd->phy_tx_seq = pkt->control & PKT_CONTROL_SQN;
|
|
233
234
|
if (is_pd_mode(pd) ||
|
|
234
235
|
(is_cp_mode(pd) && ISSET_FLAG(pd, PD_FLAG_CP_USE_CRC))) {
|
|
235
236
|
pkt->control |= PKT_CONTROL_CRC;
|
|
@@ -422,13 +423,30 @@ static int phy_validate_header(struct osdp_pd *pd, uint8_t *buf,
|
|
|
422
423
|
}
|
|
423
424
|
|
|
424
425
|
pkt_len = ((uint32_t)pkt->len_msb << 8) | pkt->len_lsb;
|
|
425
|
-
|
|
426
|
+
/**
|
|
427
|
+
* The mark byte is not counted in the packet's length field but it is
|
|
428
|
+
* buffered along with the packet, so it must be charged against the
|
|
429
|
+
* space the packet has to fit into. Validating pkt_len alone lets a
|
|
430
|
+
* peer declare a full-capacity packet behind a mark byte and overrun
|
|
431
|
+
* the buffer by one byte.
|
|
432
|
+
*/
|
|
433
|
+
if (pkt_len + mark > max_len ||
|
|
426
434
|
pkt_len < sizeof(struct osdp_packet_header) + 1 ||
|
|
427
435
|
(is_cp_mode(pd) && !(pkt->pd_address & 0x80)) ||
|
|
428
|
-
(is_pd_mode(pd) &&
|
|
436
|
+
(is_pd_mode(pd) && (pkt->pd_address & 0x80))) {
|
|
429
437
|
return OSDP_ERR_PKT_FMT;
|
|
430
438
|
}
|
|
431
439
|
|
|
440
|
+
/**
|
|
441
|
+
* Wrong-direction packets must be silently skipped; on a multi-drop
|
|
442
|
+
* bus, every PD sees every other PD's replies (along with commands to
|
|
443
|
+
* other PDs).
|
|
444
|
+
*/
|
|
445
|
+
if ((is_cp_mode(pd) && !(pkt->pd_address & 0x80)) ||
|
|
446
|
+
(is_pd_mode(pd) && (pkt->pd_address & 0x80))) {
|
|
447
|
+
return OSDP_ERR_PKT_SKIP;
|
|
448
|
+
}
|
|
449
|
+
|
|
432
450
|
return (int)(pkt_len + mark);
|
|
433
451
|
}
|
|
434
452
|
|
|
@@ -898,10 +916,14 @@ void osdp_phy_state_reset(struct osdp_pd *pd, bool is_error)
|
|
|
898
916
|
pd->packet_buf = pd->packet_buf_store;
|
|
899
917
|
if (is_error) {
|
|
900
918
|
pd->phy_retry_count = 0;
|
|
919
|
+
pd->phy_tx_seq = 0;
|
|
901
920
|
phy_reset_seq_number(pd);
|
|
902
921
|
if (pd->channel.flush) {
|
|
903
922
|
pd->channel.flush(pd->channel.data);
|
|
904
923
|
}
|
|
924
|
+
#ifndef OPT_OSDP_RX_ZERO_COPY
|
|
925
|
+
osdp_rb_reset(pd->rx.rb);
|
|
926
|
+
#endif
|
|
905
927
|
}
|
|
906
928
|
}
|
|
907
929
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|