*
* NAME
*
- * typedef unsigned char SilcPacketType;
+ * typedef SilcUInt8 SilcPacketType;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef unsigned char SilcPacketType;
+typedef SilcUInt8 SilcPacketType;
/* SILC Packet types. */
#define SILC_PACKET_NONE 0 /* NULL, never sent */
*
* NAME
*
- * typedef unsigned char SilcPacketVersion;
+ * typedef SilcUInt8 SilcPacketVersion;
*
* DESCRIPTION
*
* SILC packet version type definition.
*
***/
-typedef unsigned char SilcPacketVersion;
+typedef SilcUInt8 SilcPacketVersion;
/****d* silccore/SilcPacketAPI/SilcPacketFlags
*
* NAME
*
- * typedef unsigned char SilcPacketFlags;
+ * typedef SilcUInt8 SilcPacketFlags;
*
* DESCRIPTION
*
*
* SOURCE
*/
-typedef unsigned char SilcPacketFlags;
+typedef SilcUInt8 SilcPacketFlags;
/* All defined packet flags */
#define SILC_PACKET_FLAG_NONE 0x00 /* No flags */
*
* SOURCE
*/
-#define SILC_PACKET_LENGTH(__packet, __ret_truelen, __ret_paddedlen) \
-do { \
- SILC_GET16_MSB((__ret_truelen), (__packet)->data); \
- (__ret_paddedlen) = (__ret_truelen) + (__packet)->data[4]; \
+#define SILC_PACKET_LENGTH(__packetdata, __ret_truelen, __ret_paddedlen) \
+do { \
+ SILC_GET16_MSB((__ret_truelen), (__packetdata)); \
+ (__ret_paddedlen) = (__ret_truelen) + (SilcUInt8)(__packetdata)[4]; \
} while(0)
/***/
*
* DESCRIPTION
*
- * Returns the length of the padding in the packet. This is used
+ * Calculates the length of the padding in the packet. This is used
* by various library routines to determine needed padding length.
*
* SOURCE
*/
-#define SILC_PACKET_PADLEN(__packetlen, __blocklen) \
- SILC_PACKET_DEFAULT_PADLEN - (__packetlen) % \
- ((__blocklen) ? (__blocklen) : SILC_PACKET_DEFAULT_PADLEN)
+#define SILC_PACKET_PADLEN(__packetlen, __blocklen, __padlen) \
+do { \
+ __padlen = (SILC_PACKET_DEFAULT_PADLEN - (__packetlen) % \
+ ((__blocklen) ? (__blocklen) : SILC_PACKET_DEFAULT_PADLEN)); \
+ if (__padlen < 8) \
+ __padlen += ((__blocklen) ? (__blocklen) : SILC_PACKET_DEFAULT_PADLEN); \
+} while(0)
/***/
/****d* silccore/SilcPacketAPI/SILC_PACKET_PADLEN_MAX
* DESCRIPTION
*
* Returns the length of the padding up to the maximum length, which
- * is 128 butes. This is used by various library routines to determine
+ * is 128 bytes. This is used by various library routines to determine
* needed padding length.
*
* SOURCE
*/
-#define SILC_PACKET_PADLEN_MAX(__packetlen) \
- SILC_PACKET_MAX_PADLEN - (__packetlen) % SILC_PACKET_MAX_PADLEN
+#define SILC_PACKET_PADLEN_MAX(__packetlen, __blocklen, __padlen) \
+do { \
+ __padlen = (SILC_PACKET_MAX_PADLEN - (__packetlen) % \
+ ((__blocklen) ? (__blocklen) : SILC_PACKET_DEFAULT_PADLEN)); \
+} while(0)
/***/
/* Prototypes */
* bool silc_packet_receive_process(SilcSocketConnection sock,
* bool local_is_router,
* SilcCipher cipher, SilcHmac hmac,
+ * SilcUInt32 sequence,
* SilcPacketParserCallback parser,
* void *parser_context);
*