Frameworks/libpurple.framework/Versions/0.5.6/Headers/servconn.h
branchadium-1.3
changeset 350 708bedafdc3a
parent 349 17ef128722b7
child 351 b01ab9b157f9
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.5.6/Headers/servconn.h	Sun Jun 21 22:04:11 2009 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,181 +0,0 @@
     1.4 -/**
     1.5 - * @file servconn.h Server connection functions
     1.6 - *
     1.7 - * purple
     1.8 - *
     1.9 - * Purple is the legal property of its developers, whose names are too numerous
    1.10 - * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.11 - * source distribution.
    1.12 - *
    1.13 - * This program is free software; you can redistribute it and/or modify
    1.14 - * it under the terms of the GNU General Public License as published by
    1.15 - * the Free Software Foundation; either version 2 of the License, or
    1.16 - * (at your option) any later version.
    1.17 - *
    1.18 - * This program is distributed in the hope that it will be useful,
    1.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 - * GNU General Public License for more details.
    1.22 - *
    1.23 - * You should have received a copy of the GNU General Public License
    1.24 - * along with this program; if not, write to the Free Software
    1.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.26 - */
    1.27 -#ifndef _MSN_SERVCONN_H_
    1.28 -#define _MSN_SERVCONN_H_
    1.29 -
    1.30 -typedef struct _MsnServConn MsnServConn;
    1.31 -
    1.32 -#include "session.h"
    1.33 -#include "cmdproc.h"
    1.34 -
    1.35 -#include "proxy.h"
    1.36 -#include "httpconn.h"
    1.37 -
    1.38 -/**
    1.39 - * Connection error types.
    1.40 - */
    1.41 -typedef enum
    1.42 -{
    1.43 -	MSN_SERVCONN_ERROR_NONE,
    1.44 -	MSN_SERVCONN_ERROR_CONNECT,
    1.45 -	MSN_SERVCONN_ERROR_WRITE,
    1.46 -	MSN_SERVCONN_ERROR_READ
    1.47 -
    1.48 -} MsnServConnError;
    1.49 -
    1.50 -/**
    1.51 - * Connection types.
    1.52 - */
    1.53 -typedef enum
    1.54 -{
    1.55 -	MSN_SERVCONN_NS,
    1.56 -	MSN_SERVCONN_SB
    1.57 -
    1.58 -} MsnServConnType;
    1.59 -
    1.60 -/**
    1.61 - * A Connection.
    1.62 - */
    1.63 -struct _MsnServConn
    1.64 -{
    1.65 -	MsnServConnType type; /**< The type of this connection. */
    1.66 -	MsnSession *session;  /**< The MSN session of this connection. */
    1.67 -	MsnCmdProc *cmdproc;  /**< The command processor of this connection. */
    1.68 -
    1.69 -	PurpleProxyConnectData *connect_data;
    1.70 -
    1.71 -	gboolean connected;   /**< A flag that states if it's connected. */
    1.72 -	gboolean processing;  /**< A flag that states if something is working
    1.73 -							with this connection. */
    1.74 -	gboolean wasted;      /**< A flag that states if it should be destroyed. */
    1.75 -
    1.76 -	char *host; /**< The host this connection is connected or should be
    1.77 -				  connected to. */
    1.78 -	int num; /**< A number id of this connection. */
    1.79 -
    1.80 -	MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */
    1.81 -
    1.82 -	int fd; /**< The connection's file descriptor. */
    1.83 -	int inpa; /**< The connection's input handler. */
    1.84 -
    1.85 -	char *rx_buf; /**< The receive buffer. */
    1.86 -	int rx_len; /**< The receive buffer lenght. */
    1.87 -
    1.88 -	size_t payload_len; /**< The length of the payload.
    1.89 -						  It's only set when we've received a command that
    1.90 -						  has a payload. */
    1.91 -
    1.92 -	PurpleCircBuffer *tx_buf;
    1.93 -	guint tx_handler;
    1.94 -
    1.95 -	void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */
    1.96 -	void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */
    1.97 -	void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */
    1.98 -};
    1.99 -
   1.100 -/**
   1.101 - * Creates a new connection object.
   1.102 - *
   1.103 - * @param session The session.
   1.104 - * @param type The type of the connection.
   1.105 - */
   1.106 -MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type);
   1.107 -
   1.108 -/**
   1.109 - * Destroys a connection object.
   1.110 - *
   1.111 - * @param servconn The connection.
   1.112 - */
   1.113 -void msn_servconn_destroy(MsnServConn *servconn);
   1.114 -
   1.115 -/**
   1.116 - * Connects to a host.
   1.117 - *
   1.118 - * @param servconn The connection.
   1.119 - * @param host The host.
   1.120 - * @param port The port.
   1.121 - * @param force Force this servconn to connect to a new server.
   1.122 - */
   1.123 -gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port,
   1.124 -                              gboolean force);
   1.125 -
   1.126 -/**
   1.127 - * Disconnects.
   1.128 - *
   1.129 - * @param servconn The connection.
   1.130 - */
   1.131 -void msn_servconn_disconnect(MsnServConn *servconn);
   1.132 -
   1.133 -/**
   1.134 - * Sets the connect callback.
   1.135 - *
   1.136 - * @param servconn The servconn.
   1.137 - * @param connect_cb The connect callback.
   1.138 - */
   1.139 -void msn_servconn_set_connect_cb(MsnServConn *servconn,
   1.140 -								 void (*connect_cb)(MsnServConn *));
   1.141 -/**
   1.142 - * Sets the disconnect callback.
   1.143 - *
   1.144 - * @param servconn The servconn.
   1.145 - * @param disconnect_cb The disconnect callback.
   1.146 - */
   1.147 -void msn_servconn_set_disconnect_cb(MsnServConn *servconn,
   1.148 -									void (*disconnect_cb)(MsnServConn *));
   1.149 -/**
   1.150 - * Sets the destroy callback.
   1.151 - *
   1.152 - * @param servconn The servconn that's being destroyed.
   1.153 - * @param destroy_cb The destroy callback.
   1.154 - */
   1.155 -void msn_servconn_set_destroy_cb(MsnServConn *servconn,
   1.156 -								 void (*destroy_cb)(MsnServConn *));
   1.157 -
   1.158 -/**
   1.159 - * Writes a chunck of data to the servconn.
   1.160 - *
   1.161 - * @param servconn The servconn.
   1.162 - * @param buf The data to write.
   1.163 - * @param size The size of the data.
   1.164 - */
   1.165 -gssize msn_servconn_write(MsnServConn *servconn, const char *buf,
   1.166 -						  size_t size);
   1.167 -
   1.168 -/**
   1.169 - * Function to call whenever an error related to a switchboard occurs.
   1.170 - *
   1.171 - * @param servconn The servconn.
   1.172 - * @param error The error that happened.
   1.173 - */
   1.174 -void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error);
   1.175 -
   1.176 -/**
   1.177 - * Process the data in servconn->rx_buf.  This is called after reading
   1.178 - * data from the socket.
   1.179 - *
   1.180 - * @param servconn The servconn.
   1.181 - */
   1.182 -void msn_servconn_process_data(MsnServConn *servconn);
   1.183 -
   1.184 -#endif /* _MSN_SERVCONN_H_ */