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-- |
147 | 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 |
||
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 | 24 |
#include <glib.h> |
25 |
||
196
209bfa124066
Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents:
149
diff
changeset
|
26 |
#include "lm-internals.h" |
147 | 27 |
|
149 | 28 |
typedef struct _LmSocket LmSocket; |
147 | 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 | 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 | 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 | 75 |
|
148 | 76 |
#endif /* __LM_SOCKET_H__ */ |
149 | 77 |