src/lib/tcp.h
author Tero Marttila <terom@fixme.fi>
Thu, 28 May 2009 01:17:36 +0300
branchnew-lib-errors
changeset 219 cefec18b8268
parent 177 src/tcp.h@a74b55104fb9
permissions -rw-r--r--
some of the lib/transport stuff compiles
219
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 177
diff changeset
     1
#ifndef LIBQMSK_TCP_H
cefec18b8268 some of the lib/transport stuff compiles
Tero Marttila <terom@fixme.fi>
parents: 177
diff changeset
     2
#define LIBQMSK_TCP_H
155
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
/**
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
 * @file
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
 *
177
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
     7
 * TCP transport/service implementation.
155
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
 *
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
 * XXX: provide some TCP-specific type/functions?
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
 */
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
#include "transport.h"
177
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    12
#include "service.h"
155
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
/**
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
 * Connect the given transport via TCP to the given host/service. The transport will not be ready for use until the
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
 * transport_callbacks::on_connect callback has been invoked.
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
 *
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
 * XXX: blocking DNS resolution
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
 *
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
 * @param info the transport setup info
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
 * @param transport_ptr returned transport
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
 * @param host the hostname to connect to
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
 * @param service the service name (i.e. port) to connect to
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
 * @param err returned error info
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
 */
177
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    26
err_t tcp_connect (const struct transport_info *info, transport_t **transport_ptr, 
155
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
        const char *host, const char *service, error_t *err);
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
177
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    29
/**
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    30
 * Create a passive/listening TCP socket on the given interface/port (NULL to pick automatically).
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    31
 */
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    32
err_t tcp_listen (const struct service_info *info, service_t **service_ptr, 
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    33
        const char *interface, const char *service, error_t *err);
a74b55104fb9 rename sock_tcp to tcp_{transport,client}, fix irc_net_connect to use log_err/tcp_connect
Tero Marttila <terom@fixme.fi>
parents: 169
diff changeset
    34
155
c59d3eaff0fb most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
#endif