ia64/xen-unstable

view tools/vnet/vnetd/connection.h @ 8740:3d7ea7972b39

Update patches for linux 2.6.15.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 02 17:16:00 2006 +0000 (2006-02-02)
parents 0a4b76b6b5a0
children 71b0f00f6344
line source
1 /*
2 * Copyright (C) 2003 - 2004 Mike Wray <mike.wray@hp.com>.
3 *
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 2.1 of the
7 * License, or (at your option) any later version. This library is
8 * distributed in the hope that it will be useful, but WITHOUT ANY
9 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE.
11 * See the GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17 #ifndef _VNET_CONNECTION_H_
18 #define _VNET_CONNECTION_H_
20 #include <netinet/in.h>
22 #include "iostream.h"
24 /** A connection.
25 * The underlying transport is a socket.
26 * Contains in and out streams using the socket.
27 */
28 typedef struct Conn {
29 struct sockaddr_in addr;
30 int sock;
31 int type;
32 IOStream *in;
33 IOStream *out;
34 int (*fn)(struct Conn *);
35 void *data;
36 } Conn;
38 typedef struct ConnList {
39 Conn *conn;
40 struct ConnList *next;
41 } ConnList;
43 extern ConnList * ConnList_add(Conn *conn, ConnList *l);
45 extern Conn * Conn_new(int (*fn)(struct Conn *), void *data);
46 extern int Conn_init(Conn *conn, int sock, int type, struct sockaddr_in addr);
47 extern int Conn_connect(Conn *conn, int type, struct in_addr ipaddr, uint16_t port);
48 extern int Conn_handle(Conn *conn);
49 extern void Conn_close(Conn *conn);
51 #endif /* ! _VNET_CONNECTION_H_ */