Frameworks/libpurple.framework/Versions/0.6.2/Headers/yahoo_packet.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2571 Frameworks/libpurple.framework/Versions/0.6.0/Headers/yahoo_packet.h@75fb8ee8f2e6
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * @file yahoo_packet.h The Yahoo! protocol plugin
     3  *
     4  * purple
     5  *
     6  * Purple is the legal property of its developers, whose names are too numerous
     7  * to list here.  Please refer to the COPYRIGHT file distributed with this
     8  * source distribution.
     9  *
    10  * This program is free software; you can redistribute it and/or modify
    11  * it under the terms of the GNU General Public License as published by
    12  * the Free Software Foundation; either version 2 of the License, or
    13  * (at your option) any later version.
    14  *
    15  * This program is distributed in the hope that it will be useful,
    16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    18  * GNU General Public License for more details.
    19  *
    20  * You should have received a copy of the GNU General Public License
    21  * along with this program; if not, write to the Free Software
    22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    23  */
    24 
    25 #ifndef _YAHOO_PACKET_H_
    26 #define _YAHOO_PACKET_H_
    27 
    28 enum yahoo_service { /* these are easier to see in hex */
    29 	YAHOO_SERVICE_LOGON = 1,
    30 	YAHOO_SERVICE_LOGOFF,
    31 	YAHOO_SERVICE_ISAWAY,
    32 	YAHOO_SERVICE_ISBACK,
    33 	YAHOO_SERVICE_IDLE, /* 5 (placemarker) */
    34 	YAHOO_SERVICE_MESSAGE,
    35 	YAHOO_SERVICE_IDACT,
    36 	YAHOO_SERVICE_IDDEACT,
    37 	YAHOO_SERVICE_MAILSTAT,
    38 	YAHOO_SERVICE_USERSTAT, /* 0xa */
    39 	YAHOO_SERVICE_NEWMAIL,
    40 	YAHOO_SERVICE_CHATINVITE,
    41 	YAHOO_SERVICE_CALENDAR,
    42 	YAHOO_SERVICE_NEWPERSONALMAIL,
    43 	YAHOO_SERVICE_NEWCONTACT,
    44 	YAHOO_SERVICE_ADDIDENT, /* 0x10 */
    45 	YAHOO_SERVICE_ADDIGNORE,
    46 	YAHOO_SERVICE_PING,
    47 	YAHOO_SERVICE_GOTGROUPRENAME,
    48 	YAHOO_SERVICE_SYSMESSAGE = 0x14,
    49 	YAHOO_SERVICE_SKINNAME = 0x15,
    50 	YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
    51 	YAHOO_SERVICE_CONFINVITE = 0x18,
    52 	YAHOO_SERVICE_CONFLOGON,
    53 	YAHOO_SERVICE_CONFDECLINE,
    54 	YAHOO_SERVICE_CONFLOGOFF,
    55 	YAHOO_SERVICE_CONFADDINVITE,
    56 	YAHOO_SERVICE_CONFMSG,
    57 	YAHOO_SERVICE_CHATLOGON,
    58 	YAHOO_SERVICE_CHATLOGOFF,
    59 	YAHOO_SERVICE_CHATMSG = 0x20,
    60 	YAHOO_SERVICE_GAMELOGON = 0x28,
    61 	YAHOO_SERVICE_GAMELOGOFF,
    62 	YAHOO_SERVICE_GAMEMSG = 0x2a,
    63 	YAHOO_SERVICE_FILETRANSFER = 0x46,
    64 	YAHOO_SERVICE_VOICECHAT = 0x4A,
    65 	YAHOO_SERVICE_NOTIFY = 0x4B,
    66 	YAHOO_SERVICE_VERIFY,
    67 	YAHOO_SERVICE_P2PFILEXFER,
    68 	YAHOO_SERVICE_PEERTOPEER = 0x4F,
    69 	YAHOO_SERVICE_WEBCAM,
    70 	YAHOO_SERVICE_AUTHRESP = 0x54,
    71 	YAHOO_SERVICE_LIST = 0x55,
    72 	YAHOO_SERVICE_AUTH = 0x57,
    73 	YAHOO_SERVICE_AUTHBUDDY = 0x6d,
    74 	YAHOO_SERVICE_ADDBUDDY = 0x83,
    75 	YAHOO_SERVICE_REMBUDDY = 0x84,
    76 	YAHOO_SERVICE_IGNORECONTACT,    /* > 1, 7, 13 < 1, 66, 13, 0*/
    77 	YAHOO_SERVICE_REJECTCONTACT,
    78 	YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
    79 	YAHOO_SERVICE_KEEPALIVE = 0x8A,
    80 	YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/
    81 	YAHOO_SERVICE_CHATGOTO,
    82 	YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */
    83 	YAHOO_SERVICE_CHATLEAVE,
    84 	YAHOO_SERVICE_CHATEXIT = 0x9b,
    85 	YAHOO_SERVICE_CHATADDINVITE = 0x9d,
    86 	YAHOO_SERVICE_CHATLOGOUT = 0xa0,
    87 	YAHOO_SERVICE_CHATPING,
    88 	YAHOO_SERVICE_COMMENT = 0xa8,
    89 	YAHOO_SERVICE_PRESENCE_PERM = 0xb9,
    90 	YAHOO_SERVICE_PRESENCE_SESSION = 0xba,
    91 	YAHOO_SERVICE_AVATAR = 0xbc,
    92 	YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
    93 	YAHOO_SERVICE_PICTURE = 0xbe,
    94 	YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
    95 	YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
    96 	YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5,
    97 	YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6,
    98 	YAHOO_SERVICE_AVATAR_UPDATE = 0xc7,
    99 	YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8,
   100 	YAHOO_SERVICE_AUDIBLE = 0xd0,
   101 	YAHOO_SERVICE_CONTACT_DETAILS = 0xd3,
   102 	/* YAHOO_SERVICE_CHAT_SESSION = 0xd4,?? Reports start of chat session, gets an id from server */
   103 	YAHOO_SERVICE_AUTH_REQ_15 = 0xd6,
   104 	YAHOO_SERVICE_FILETRANS_15 = 0xdc,
   105 	YAHOO_SERVICE_FILETRANS_INFO_15 = 0xdd,
   106 	YAHOO_SERVICE_FILETRANS_ACC_15 = 0xde,
   107 	/* photo sharing services ?? - 0xd2, 0xd7, 0xd8, 0xda */
   108 	YAHOO_SERVICE_CHGRP_15 = 0xe7,
   109 	YAHOO_SERVICE_STATUS_15 = 0xf0,
   110 	YAHOO_SERVICE_LIST_15 = 0xf1,
   111 	YAHOO_SERVICE_MESSAGE_ACK = 0xfb,
   112 	YAHOO_SERVICE_WEBLOGIN = 0x0226,
   113 	YAHOO_SERVICE_SMS_MSG = 0x02ea
   114 	/* YAHOO_SERVICE_DISCONNECT = 0x07d1 Server forces us to disconnect. Is sent with TCP FIN flag set */
   115 };
   116 
   117 struct yahoo_pair {
   118 	int key;
   119 	char *value;
   120 };
   121 
   122 struct yahoo_packet {
   123 	guint16 service;
   124 	guint32 status;
   125 	guint32 id;
   126 	GSList *hash;
   127 };
   128 
   129 #define YAHOO_WEBMESSENGER_PROTO_VER 0x0065
   130 #define YAHOO_PROTO_VER 0x0010
   131 #define YAHOO_PROTO_VER_JAPAN 0x0010
   132 
   133 #define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4)
   134 
   135 struct yahoo_packet *yahoo_packet_new(enum yahoo_service service,
   136 				      enum yahoo_status status, int id);
   137 void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...);
   138 void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value);
   139 void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value);
   140 int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd);
   141 int yahoo_packet_send_and_free(struct yahoo_packet *pkt, YahooData *yd);
   142 size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, gboolean jp,
   143 guchar **buf);
   144 void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len);
   145 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data);
   146 void yahoo_packet_dump(guchar *data, int len);
   147 size_t yahoo_packet_length(struct yahoo_packet *pkt);
   148 void yahoo_packet_free(struct yahoo_packet *pkt);
   149 
   150 #endif /* _YAHOO_PACKET_H_ */