Lines Matching refs:tpdu
87 bool Tpdu_isChecksumOk(Tpdu *tpdu) { in Tpdu_isChecksumOk() argument
94 Tpdu_toByteArray(tpdu, buffer); in Tpdu_isChecksumOk()
95 if (tpdu->checksum == in Tpdu_isChecksumOk()
96 computeCrc(buffer, (TPDU_PROLOGUE_LENGTH + tpdu->len))) { in Tpdu_isChecksumOk()
120 Tpdu *tpdu) { in Tpdu_formTpdu() argument
127 tpdu->nad = nad; in Tpdu_formTpdu()
129 tpdu->pcb = pcb; in Tpdu_formTpdu()
131 tpdu->len = len; in Tpdu_formTpdu()
136 tpdu->data[i] = data[i]; in Tpdu_formTpdu()
148 tpdu->checksum = 0; in Tpdu_formTpdu()
152 Tpdu_toByteArray(tpdu, buffer); in Tpdu_formTpdu()
155 tpdu->checksum = computeCrc(buffer, (TPDU_PROLOGUE_LENGTH + tpdu->len)); in Tpdu_formTpdu()
174 void Tpdu_getChecksumBytes(Tpdu *tpdu, uint8_t *checksumBytes) { in Tpdu_getChecksumBytes() argument
177 checksumBytes[0] = (uint8_t)tpdu->checksum; in Tpdu_getChecksumBytes()
180 checksumBytes[0] = (uint8_t)tpdu->checksum; in Tpdu_getChecksumBytes()
181 checksumBytes[1] = (uint8_t)(tpdu->checksum >> 8); in Tpdu_getChecksumBytes()
221 TpduType Tpdu_getType(Tpdu *tpdu) { in Tpdu_getType() argument
222 if ((tpdu->pcb & 0x80) == 0x00) { in Tpdu_getType()
224 } else if ((tpdu->pcb & 0xC0) == 0x80) { in Tpdu_getType()
269 void Tpdu_toHexString(Tpdu *tpdu, uint8_t *hexStringBuffer) { in Tpdu_toHexString() argument
270 uint8_t buffer[tpdu->len + 5]; in Tpdu_toHexString()
271 uint16_t length = Tpdu_toByteArray(tpdu, buffer); in Tpdu_toHexString()