comparison libgaim/protocols/oscar/oscar.h @ 15107:f41cd6f78c60

[gaim-migrate @ 17892] Use GHashTable and GQueue instead of GSList in a few places in oscar. The speed improvements probably won't be noticeable. 4 files changed, 48 insertions(+), 106 deletions(-) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 04 Dec 2006 11:14:11 +0000
parents b2b0839f57d0
children 917a50335af3
comparison
equal deleted inserted replaced
15106:b2b0839f57d0 15107:f41cd6f78c60
390 guint16 type; 390 guint16 type;
391 guint16 subtype; 391 guint16 subtype;
392 guint16 seqnum; /**< The sequence number of most recent outgoing packet. */ 392 guint16 seqnum; /**< The sequence number of most recent outgoing packet. */
393 GSList *groups; 393 GSList *groups;
394 GSList *rateclasses; /* Contains nodes of struct rateclass. */ 394 GSList *rateclasses; /* Contains nodes of struct rateclass. */
395 /* TODO: Maybe use a GHashTable for rateclasses */ 395
396 396 GQueue *queued_snacs; /**< Contains QueuedSnacs. */
397 GSList *queued_snacs; /**< Contains QueuedSnacs. */ 397 guint queued_timeout;
398 guint outgoing_timeout;
399 /* TODO: Maybe use a GQueue for outgoing_snacs */
400 398
401 void *internal; /* internal conn-specific libfaim data */ 399 void *internal; /* internal conn-specific libfaim data */
402 }; 400 };
403 401
404 struct _IcbmCookie 402 struct _IcbmCookie
502 time_t timestamp; 500 time_t timestamp;
503 gboolean waiting_for_ack; 501 gboolean waiting_for_ack;
504 gboolean in_transaction; 502 gboolean in_transaction;
505 } ssi; 503 } ssi;
506 504
507 /* TODO: Implement this as a HashTable for HUGE speed improvement! */ 505 GHashTable *handlerlist;
508 GSList *handlerlist;
509 506
510 /** A linked list containing FlapConnections. */ 507 /** A linked list containing FlapConnections. */
511 GSList *oscar_connections; 508 GSList *oscar_connections;
512 509
513 /** A linked list containing PeerConnections. */ 510 /** A linked list containing PeerConnections. */
576 int aim_send_login(OscarData *, FlapConnection *, const char *, const char *, ClientInfo *, const char *key); 573 int aim_send_login(OscarData *, FlapConnection *, const char *, const char *, ClientInfo *, const char *key);
577 /* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid); 574 /* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid);
578 575
579 void aim_cleansnacs(OscarData *, int maxage); 576 void aim_cleansnacs(OscarData *, int maxage);
580 577
581 int oscar_data_addhandler(OscarData *od, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags); 578 void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags);
582 void aim_clearhandlers(OscarData *od); 579 aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype);
583 580
584 /* flap_connection.c */ 581 /* flap_connection.c */
585 FlapConnection *flap_connection_new(OscarData *, int type); 582 FlapConnection *flap_connection_new(OscarData *, int type);
586 void flap_connection_close(OscarData *od, FlapConnection *conn); 583 void flap_connection_close(OscarData *od, FlapConnection *conn);
587 void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message); 584 void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
1540 int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len); 1537 int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len);
1541 int byte_stream_putstr(ByteStream *bs, const char *str); 1538 int byte_stream_putstr(ByteStream *bs, const char *str);
1542 int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len); 1539 int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len);
1543 int byte_stream_putcaps(ByteStream *bs, guint32 caps); 1540 int byte_stream_putcaps(ByteStream *bs, guint32 caps);
1544 1541
1545 /* rxhandlers.c */
1546 aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 type);
1547
1548 /* 1542 /*
1549 * Generic SNAC structure. Rarely if ever used. 1543 * Generic SNAC structure. Rarely if ever used.
1550 */ 1544 */
1551 typedef struct aim_snac_s { 1545 typedef struct aim_snac_s {
1552 aim_snacid_t id; 1546 aim_snacid_t id;
1567 1561
1568 struct chatsnacinfo { 1562 struct chatsnacinfo {
1569 guint16 exchange; 1563 guint16 exchange;
1570 char name[128]; 1564 char name[128];
1571 guint16 instance; 1565 guint16 instance;
1572 };
1573
1574 struct snacpair {
1575 guint16 group;
1576 guint16 subtype;
1577 }; 1566 };
1578 1567
1579 struct rateclass { 1568 struct rateclass {
1580 guint16 classid; 1569 guint16 classid;
1581 guint32 windowsize; 1570 guint32 windowsize;
1584 guint32 limit; 1573 guint32 limit;
1585 guint32 disconnect; 1574 guint32 disconnect;
1586 guint32 current; 1575 guint32 current;
1587 guint32 max; 1576 guint32 max;
1588 guint8 unknown[5]; /* only present in versions >= 3 */ 1577 guint8 unknown[5]; /* only present in versions >= 3 */
1589 GSList *members; /* Contains node of struct snacpair */ 1578 GHashTable *members; /* Key is family and subtype, value is TRUE. */
1590 /* TODO: Maybe use a GHashTable for members */
1591 1579
1592 struct timeval last; /**< The time when we last sent a SNAC of this rate class. */ 1580 struct timeval last; /**< The time when we last sent a SNAC of this rate class. */
1593 }; 1581 };
1594 1582
1595 int aim_cachecookie(OscarData *od, IcbmCookie *cookie); 1583 int aim_cachecookie(OscarData *od, IcbmCookie *cookie);