Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/slpmsg.h
branchadium-1.5.11-merge
changeset 6013 f8d0dc659e3f
parent 5941 307f53385811
parent 6012 200a01709ba4
child 6014 fcb71cb71a3d
child 6015 2b01cc935b7c
equal deleted inserted replaced
5941:307f53385811 6013:f8d0dc659e3f
     1 /**
       
     2  * @file slpmsg.h SLP Message functions
       
     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 #ifndef _MSN_SLPMSG_H_
       
    25 #define _MSN_SLPMSG_H_
       
    26 
       
    27 typedef struct _MsnSlpMessage MsnSlpMessage;
       
    28 
       
    29 #include "imgstore.h"
       
    30 
       
    31 #include "slpcall.h"
       
    32 #include "slplink.h"
       
    33 #include "session.h"
       
    34 #include "p2p.h"
       
    35 
       
    36 #include "slp.h"
       
    37 
       
    38 /**
       
    39  * A SLP Message  This contains everything that we will need to send a SLP
       
    40  * Message even if has to be sent in several parts.
       
    41  */
       
    42 struct _MsnSlpMessage
       
    43 {
       
    44 	MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */
       
    45 	MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */
       
    46 	MsnSession *session;
       
    47 
       
    48 	MsnP2PInfo *p2p_info;
       
    49 
       
    50 	long id;
       
    51 
       
    52 	gboolean ft;
       
    53 	PurpleStoredImage *img;
       
    54 	guchar *buffer;
       
    55 
       
    56 	/**
       
    57 	 * This is the size of buffer, unless this is an outgoing file transfer,
       
    58 	 * in which case this is the size of the file.
       
    59 	 */
       
    60 	gsize size;
       
    61 
       
    62 	GList *parts; /**< A list with the SlpMsgParts */
       
    63 
       
    64 	const char *info;
       
    65 	gboolean text_body;
       
    66 };
       
    67 
       
    68 /**
       
    69  * Creates a new slp message
       
    70  *
       
    71  * @param slplink The slplink through which this slp message will be sent.
       
    72  * If it's set to NULL, it is a temporary SlpMessage.
       
    73  * @return The created slp message.
       
    74  */
       
    75 MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink, MsnSlpCall *slpcall);
       
    76 
       
    77 /**
       
    78  * Destroys a slp message
       
    79  *
       
    80  * @param slpmsg The slp message to destory.
       
    81  */
       
    82 void msn_slpmsg_destroy(MsnSlpMessage *slpmsg);
       
    83 
       
    84 /**
       
    85  * Relate this SlpMessage with an existing SlpLink
       
    86  *
       
    87  * @param slplink 	The SlpLink that will send this message.
       
    88  */
       
    89 void msn_slpmsg_set_slplink(MsnSlpMessage *slpmsg, MsnSlpLink *slplink);
       
    90 
       
    91 void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body,
       
    92 						 long long size);
       
    93 void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img);
       
    94 MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq,
       
    95 								   const char *header,
       
    96 								   const char *branch,
       
    97 								   const char *content_type,
       
    98 								   const char *content);
       
    99 
       
   100 /**
       
   101  * Create a new SLP Ack message
       
   102  *
       
   103  * @param header the value of the header in this slpmsg.
       
   104  *
       
   105  * @return A new SlpMessage with ACK headers
       
   106  */
       
   107 MsnSlpMessage *msn_slpmsg_ack_new(MsnSlpLink *slplink, MsnP2PInfo *info);
       
   108 
       
   109 /**
       
   110  * Create a new SLP message for MsnObject data.
       
   111  *
       
   112  * @param slpcall 	The slpcall that manages this message.
       
   113  * @param img 		The image to be sent in this message.
       
   114  *
       
   115  * @return A new SlpMessage with MsnObject info.
       
   116  */
       
   117 MsnSlpMessage *msn_slpmsg_obj_new(MsnSlpCall *slpcall, PurpleStoredImage *img);
       
   118 
       
   119 /**
       
   120  * Create a new SLP message for data preparation.
       
   121  *
       
   122  * @param slpcall 	The slpcall that manages this message.
       
   123  *
       
   124  * @return A new SlpMessage with data preparation info.
       
   125  */
       
   126 MsnSlpMessage *msn_slpmsg_dataprep_new(MsnSlpCall *slpcall);
       
   127 
       
   128 /**
       
   129  * Create a new SLP message for File transfer.
       
   130  *
       
   131  * @param slpcall 	The slpcall that manages this message.
       
   132  * @param size 		The size of the file being transsmited.
       
   133  *
       
   134  * @return A new SlpMessage with the file transfer info.
       
   135  */
       
   136 MsnSlpMessage *msn_slpmsg_file_new(MsnSlpCall *slpcall, size_t size);
       
   137 
       
   138 /**
       
   139  * Serialize the MsnSlpMessage in a way it can be used to be transmited
       
   140  *
       
   141  * @param slpmsg 	The MsnSlpMessage.
       
   142  * @param ret_size 	The size of the buffer cointaining the message.
       
   143  *
       
   144  * @return a buffer with the serialized data.
       
   145  */
       
   146 char *msn_slpmsg_serialize(MsnSlpMessage *slpmsg, size_t *ret_size);
       
   147 
       
   148 void msn_slpmsg_show_readable(MsnSlpMessage *slpmsg);
       
   149 
       
   150 #endif /* _MSN_SLPMSG_H_ */