loudmouth/inc/lm-socket.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
       
     2 /*
       
     3  * Copyright (C) 2006 Imendio AB
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public License as
       
     7  * published by the Free Software Foundation; either version 2 of the
       
     8  * License, or (at your option) any later version.
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this program; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 #ifndef __LM_SOCKET_H__ 
       
    22 #define __LM_SOCKET_H__
       
    23 
       
    24 #include <glib.h>
       
    25 
       
    26 #include "lm-internals.h"
       
    27 
       
    28 typedef struct _LmSocket LmSocket;
       
    29 
       
    30 typedef void    (* IncomingDataFunc)  (LmSocket       *socket,
       
    31 				       const gchar    *buf,
       
    32 				       gpointer        user_data);
       
    33 
       
    34 typedef void    (* SocketClosedFunc)  (LmSocket       *socket,
       
    35 				       LmDisconnectReason reason,
       
    36 				       gpointer        user_data);
       
    37 
       
    38 typedef void    (* ConnectResultFunc) (LmSocket        *socket,
       
    39 				       gboolean         result,
       
    40 				       gpointer         user_data);
       
    41 
       
    42 gboolean  lm_socket_output_is_buffered    (LmSocket       *socket,
       
    43 					   const gchar    *buffer,
       
    44 					   gint            len);
       
    45 void      lm_socket_setup_output_buffer   (LmSocket       *socket,
       
    46 					   const gchar    *buffer,
       
    47 					   gint            len);
       
    48 gint      lm_socket_do_write              (LmSocket       *socket,
       
    49 					   const gchar    *buf,
       
    50 					   gint            len);
       
    51 
       
    52 LmSocket *  lm_socket_create              (GMainContext   *context, 
       
    53 					   IncomingDataFunc data_func,
       
    54 					   SocketClosedFunc closed_func,
       
    55 					   ConnectResultFunc connect_func,
       
    56 					   gpointer         user_data,
       
    57 					   LmConnection   *connection,
       
    58 					   gboolean        blocking,
       
    59 					   const gchar    *server, 
       
    60 					   const gchar    *domain,
       
    61 					   guint           port, 
       
    62 					   LmSSL          *ssl,
       
    63 					   LmProxy        *proxy,
       
    64 					   GError        **error);
       
    65 void        lm_socket_flush               (LmSocket       *socket);
       
    66 void        lm_socket_close               (LmSocket       *socket);
       
    67 LmSocket *  lm_socket_ref                 (LmSocket       *socket);
       
    68 void        lm_socket_unref               (LmSocket       *socket);
       
    69 #ifdef HAVE_ASYNCNS
       
    70 void	    _asyncns_cancel               (LmSocket *socket);
       
    71 #endif
       
    72 gboolean    lm_socket_starttls            (LmSocket *socket);
       
    73 gboolean    lm_socket_set_keepalive       (LmSocket *socket, int delay);
       
    74 gchar *     lm_socket_get_local_host      (LmSocket *socket);
       
    75 
       
    76 #endif /* __LM_SOCKET_H__ */
       
    77