/* All defined packet flags */
#define SILC_PACKET_FLAG_NONE 0x00
#define SILC_PACKET_FLAG_PRIVMSG_KEY 0x01
-#define SILC_PACKET_FLAG_FORWARDED 0x02
-#define SILC_PACKET_FLAG_BROADCAST 0x04
-#define SILC_PACKET_FLAG_TUNNELED 0x08
+#define SILC_PACKET_FLAG_BROADCAST 0x02
+#define SILC_PACKET_FLAG_TUNNELED 0x04
/* Rest of flags still available
+#define SILC_PACKET_FLAG_XXX 0x08
#define SILC_PACKET_FLAG_XXX 0x10
#define SILC_PACKET_FLAG_XXX 0x20
#define SILC_PACKET_FLAG_XXX 0x40
Packet flags. Flags are defined above.
unsigned char *src_id
- unsigned int src_id_len
- SilcIdType src_id_type
+ unsigned short src_id_len
+ unsigned char src_id_type
Source ID, its length and type. On packet reception retuned ID's
are always the hash values of the ID's from the packet.
+ unsigned char *dst_id;
+ unsigned short dst_id_len;
+ unsigned char src_id_type;
+
+ Destination ID, its length and type. On packet reception retuned
+ ID's are always the hash values of the ID's from the packet.
+
SilcHash hash
Pointer to allocated hash object. This must be MD5 hash object.
SilcPacketFlags flags;
unsigned char *src_id;
- unsigned int src_id_len;
- SilcIdType src_id_type;
+ unsigned short src_id_len;
+ unsigned char src_id_type;
unsigned char *dst_id;
- unsigned int dst_id_len;
- SilcIdType dst_id_type;
+ unsigned short dst_id_len;
+ unsigned char dst_id_type;
- unsigned int truelen;
- unsigned int padlen;
+ unsigned short truelen;
+ unsigned short padlen;
/* For padding generation */
SilcRng rng;
+
+ /* Back pointers */
+ void *context;
+ SilcSocketConnection sock;
+
+ /* Reference count for this context. The context is free'd only
+ after the reference count is zero. */
+ int users;
} SilcPacketContext;
/*
int silc_packet_receive(SilcSocketConnection sock);
int silc_packet_decrypt(SilcCipher cipher, SilcHmac hmac,
SilcBuffer buffer, SilcPacketContext *packet);
-int silc_packet_receive_process(SilcSocketConnection sock,
- SilcCipher cipher, SilcHmac hmac,
- SilcPacketParserCallback parser,
- void *context);
+void silc_packet_receive_process(SilcSocketConnection sock,
+ SilcCipher cipher, SilcHmac hmac,
+ SilcPacketParserCallback parser,
+ void *context);
SilcPacketType silc_packet_parse(SilcPacketContext *ctx);
SilcPacketType silc_packet_parse_special(SilcPacketContext *ctx);
+SilcPacketContext *silc_packet_context_alloc();
+SilcPacketContext *silc_packet_context_dup(SilcPacketContext *ctx);
+void silc_packet_context_free(SilcPacketContext *ctx);
#endif