lib/network.h File Reference

Network functions. More...

#include <glib.h>
#include "state.h"
#include "isupport.h"
#include <sys/socket.h>

Go to the source code of this file.

Data Structures

struct  network_connection
 Information about the connection to a network. More...
struct  irc_network
 An IRC network. More...

Defines

#define DEFAULT_NETWORK_CHARSET   NULL

Typedefs

typedef void(* network_log_fn )(enum log_level, void *, const char *)

Enumerations

enum  network_connection_state {
  NETWORK_CONNECTION_STATE_NOT_CONNECTED = 0, NETWORK_CONNECTION_STATE_RECONNECT_PENDING, NETWORK_CONNECTION_STATE_CONNECTING, NETWORK_CONNECTION_STATE_CONNECTED,
  NETWORK_CONNECTION_STATE_LOGIN_SENT, NETWORK_CONNECTION_STATE_MOTD_RECVD
}

Functions

G_MODULE_EXPORT gboolean network_set_charset (struct irc_network *n, const char *name)
 Change the character set used to communicate with the server.
G_MODULE_EXPORT gboolean autoconnect_networks (GList *)
 Autoconnect to all the networks in a list.
G_MODULE_EXPORT struct
irc_network
irc_network_new (gboolean(*process_from_server)(struct irc_network *, const struct irc_line *), struct network_config *sc)
G_MODULE_EXPORT gboolean connect_network (struct irc_network *)
 Connect to a network, returns TRUE if connection was successful (or startup of connection was successful).
G_MODULE_EXPORT void network_select_next_server (struct irc_network *n)
 Switch to the next server listed for a network.
G_MODULE_EXPORT gboolean disconnect_network (struct irc_network *s)
 Disconnect from a network.
G_MODULE_EXPORT gboolean network_send_line (struct irc_network *s, struct irc_client *c, const struct irc_line *, gboolean)
 Send a line to the network.
G_MODULE_EXPORT gboolean network_send_args (struct irc_network *s,...)
 Send a new line to the network.
G_MODULE_EXPORT void register_virtual_network (struct virtual_network_ops *)
 Register a new virtual network type.
G_MODULE_EXPORT struct
irc_network
find_network (GList *gl, const char *)
 Find a network by name.
G_MODULE_EXPORT gboolean virtual_network_recv_line (struct irc_network *l, struct irc_line *)
 Indicate that a line is received by a virtual network.
G_MODULE_EXPORT gboolean virtual_network_recv_args (struct irc_network *l, const char *origin,...)
 Indicate that a line has been received.
G_MODULE_EXPORT gboolean virtual_network_recv_response (struct irc_network *n, int num,...)
 Indicate that a response is received by a virtual network.
G_MODULE_EXPORT G_GNUC_MALLOC
struct linestack_context
new_linestack (struct irc_network *network)
G_MODULE_EXPORT G_GNUC_MALLOC
char * 
network_generate_feature_string (struct irc_network *n)
 Generate 005-response string to send to client connected to a network.
G_MODULE_EXPORT struct
irc_network
network_ref (struct irc_network *)
 Increase the reference count for a network.
G_MODULE_EXPORT void network_unref (struct irc_network *)
G_MODULE_EXPORT void network_set_log_fn (struct irc_network *s, network_log_fn, void *userdata)


Detailed Description

Network functions.


Function Documentation

G_MODULE_EXPORT gboolean autoconnect_networks ( GList *  networks  ) 

Autoconnect to all the networks in a list.

Parameters:
networks GList with networks
Returns:
TRUE

G_MODULE_EXPORT gboolean connect_network ( struct irc_network s  ) 

Connect to a network, returns TRUE if connection was successful (or startup of connection was successful).

Parameters:
s Network to connect to

G_MODULE_EXPORT gboolean disconnect_network ( struct irc_network s  ) 

Disconnect from a network.

The network will still be kept in memory, but all socket connections associated with it will be dropped.

Parameters:
s Network to disconnect from
Returns:
Whether disconnecting succeeded.

G_MODULE_EXPORT struct irc_network* find_network ( GList *  networks,
const char *  name 
) [read]

Find a network by name.

Parameters:
networks GList with possible networks
name Name of the network to search for.
Returns:
first network found or NULL

G_MODULE_EXPORT G_GNUC_MALLOC char* network_generate_feature_string ( struct irc_network n  ) 

Generate 005-response string to send to client connected to a network.

Parameters:
n Network to generate for
Returns:
An 005 string, newly allocated

G_MODULE_EXPORT struct irc_network* network_ref ( struct irc_network  )  [read]

Increase the reference count for a network.

G_MODULE_EXPORT void network_select_next_server ( struct irc_network n  ) 

Switch to the next server listed for a network.

Parameters:
n Network

G_MODULE_EXPORT gboolean network_send_args ( struct irc_network s,
  ... 
)

Send a new line to the network.

Parameters:
s Network
... Arguments terminated by NULL

G_MODULE_EXPORT gboolean network_send_line ( struct irc_network s,
struct irc_client c,
const struct irc_line ol,
gboolean  is_private 
)

Send a line to the network.

Parameters:
s Network to send to.
c Client the line was sent by originally.
ol Line to send to the network
is_private Whether the line should not be broadcast to other clients

G_MODULE_EXPORT gboolean network_set_charset ( struct irc_network n,
const char *  name 
)

Change the character set used to communicate with the server.

Parameters:
n network to change the character set for
name name of the character set to use
Returns:
true if setting the charset worked

G_MODULE_EXPORT void register_virtual_network ( struct virtual_network_ops *  ops  ) 

Register a new virtual network type.

Parameters:
ops Callback functions for the virtual network type.

G_MODULE_EXPORT gboolean virtual_network_recv_args ( struct irc_network s,
const char *  origin,
  ... 
)

Indicate that a line has been received.

Parameters:
s Network to use.
origin Origin to make the data originate from

G_MODULE_EXPORT gboolean virtual_network_recv_line ( struct irc_network s,
struct irc_line l 
)

Indicate that a line is received by a virtual network.

Parameters:
s Network to send to.
l Line to receive.

G_MODULE_EXPORT gboolean virtual_network_recv_response ( struct irc_network n,
int  num,
  ... 
)

Indicate that a response is received by a virtual network.

Parameters:
n Network to receive data
num Number of the response to receive


Generated on Mon Apr 14 00:44:20 2008 for ctrlproxy by  doxygen 1.5.5