loudmouth/lm-socket.h
author Senko Rasic <senko.rasic@collabora.co.uk>
Tue, 30 Oct 2007 23:27:30 +0100
changeset 308 7e2050a6df75
parent 292 bb7269466be2
permissions -rw-r--r--
Added lm_connection_get_client_host (forward-port from LM1.2).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     2
/*
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     3
 * Copyright (C) 2006 Imendio AB
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     4
 *
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
     9
 *
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    14
 *
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    16
 * License along with this program; if not, write to the
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    18
 * Boston, MA 02111-1307, USA.
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    19
 */
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    20
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    21
#ifndef __LM_SOCKET_H__ 
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    22
#define __LM_SOCKET_H__
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    23
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    24
#include <glib.h>
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    25
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    26
#include "lm-internals.h"
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    27
149
54e67338c784 Commiting some work in progress
hallski <hallski>
parents: 148
diff changeset
    28
typedef struct _LmSocket LmSocket;
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    29
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    30
typedef void    (* IncomingDataFunc)  (LmSocket       *socket,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    31
				       const gchar    *buf,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    32
				       gpointer        user_data);
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    33
256
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    34
typedef void    (* SocketClosedFunc)  (LmSocket       *socket,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    35
				       LmDisconnectReason reason,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    36
				       gpointer        user_data);
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    37
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    38
typedef void    (* ConnectResultFunc) (LmSocket        *socket,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    39
				       gboolean         result,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    40
				       gpointer         user_data);
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    41
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    42
gboolean  lm_socket_output_is_buffered    (LmSocket       *socket,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    43
					   const gchar    *buffer,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    44
					   gint            len);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    45
void      lm_socket_setup_output_buffer   (LmSocket       *socket,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    46
					   const gchar    *buffer,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    47
					   gint            len);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    48
gint      lm_socket_do_write              (LmSocket       *socket,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    49
					   const gchar    *buf,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    50
					   gint            len);
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    51
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    52
LmSocket *  lm_socket_create              (GMainContext   *context, 
256
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    53
					   IncomingDataFunc data_func,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    54
					   SocketClosedFunc closed_func,
2266e56746ed Refactoring to clear up interface between LmSocket and LmConnection.
Mikael Hallendal <micke@imendio.com>
parents: 244
diff changeset
    55
					   ConnectResultFunc connect_func,
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    56
					   gpointer         user_data,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    57
					   LmConnection   *connection,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    58
					   gboolean        blocking,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    59
					   const gchar    *server, 
275
37937c612f62 Made SRV handling more sane, and implemented fallback using jid domain name.
Senko Rasic <senko@phyrexia.(none)>
parents: 274
diff changeset
    60
					   const gchar    *domain,
196
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    61
					   guint           port, 
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    62
					   LmSSL          *ssl,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    63
					   LmProxy        *proxy,
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    64
					   GError        **error);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    65
void        lm_socket_flush               (LmSocket       *socket);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    66
void        lm_socket_close               (LmSocket       *socket);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    67
LmSocket *  lm_socket_ref                 (LmSocket       *socket);
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    68
void        lm_socket_unref               (LmSocket       *socket);
271
52ea4e0b897a Perform name resolution asynchronously. Patch by Senko Rašić.
Dafydd Harries <daf@rhydd.org>
parents: 256
diff changeset
    69
#ifdef HAVE_ASYNCNS
52ea4e0b897a Perform name resolution asynchronously. Patch by Senko Rašić.
Dafydd Harries <daf@rhydd.org>
parents: 256
diff changeset
    70
void	    _asyncns_cancel               (LmSocket *socket);
52ea4e0b897a Perform name resolution asynchronously. Patch by Senko Rašić.
Dafydd Harries <daf@rhydd.org>
parents: 256
diff changeset
    71
#endif
291
cebf76f7f0e9 Simplify and fix SSL/StartTLS handling in LmSocket
Senko Rasic <senko.rasic@collabora.co.uk>
parents: 275
diff changeset
    72
gboolean    lm_socket_starttls            (LmSocket *socket);
292
bb7269466be2 Use TCP keepalives on Linux if available; if not, fallback to manual keepalives.
Senko Rasic <senko.rasic@collabora.co.uk>
parents: 291
diff changeset
    73
gboolean    lm_socket_set_keepalive       (LmSocket *socket, int delay);
308
7e2050a6df75 Added lm_connection_get_client_host (forward-port from LM1.2).
Senko Rasic <senko.rasic@collabora.co.uk>
parents: 292
diff changeset
    74
gchar *     lm_socket_get_local_host      (LmSocket *socket);
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    75
148
255733936c01 styling
hallski <hallski>
parents: 147
diff changeset
    76
#endif /* __LM_SOCKET_H__ */
149
54e67338c784 Commiting some work in progress
hallski <hallski>
parents: 148
diff changeset
    77