loudmouth/lm-socket.h
author Mikael Hallendal <micke@imendio.com>
Mon, 26 Feb 2007 01:17:30 +0100
changeset 256 2266e56746ed
parent 244 8a05b79bad24
child 271 52ea4e0b897a
permissions -rw-r--r--
Refactoring to clear up interface between LmSocket and LmConnection. Continued the work to refactor out the socket code to LmSocket. Removed a couple of functions that were left in lm-internals to signal back from the socket to the connection. These are now callbacks given to LmSocket in the create function.
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, 
209bfa124066 Imported LmConnection refactor from old repository.
Mikael Hallendal <micke@imendio.com>
parents: 149
diff changeset
    60
					   guint           port, 
244
8a05b79bad24 Make use_srv optional in LmSocket and plugged a leak.
Mikael Hallendal <micke@imendio.com>
parents: 196
diff changeset
    61
					   gboolean        use_srv,
196
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);
147
f4fe28b6c454 added upcoming files lm-socket.[ch]
hallski <hallski>
parents:
diff changeset
    69
148
255733936c01 styling
hallski <hallski>
parents: 147
diff changeset
    70
#endif /* __LM_SOCKET_H__ */
149
54e67338c784 Commiting some work in progress
hallski <hallski>
parents: 148
diff changeset
    71