Patches by cras: unsigned int's to unsigned short in packet
[silc.git] / lib / silccore / silcpacket.h
index d48035135b9302e90420f917de7085cfb50dc0d1..14b1c678fa07d3793a69db3617d85cf7521dbc11 100644 (file)
@@ -94,12 +94,19 @@ typedef unsigned char SilcPacketFlags;
        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.
@@ -112,18 +119,22 @@ typedef struct {
   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;
 } SilcPacketContext;
 
 /* 
@@ -237,11 +248,12 @@ int silc_packet_read(int sock, SilcBuffer dest);
 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_dup(SilcPacketContext *ctx);
 
 #endif