1 /* $Id: connection.h,v 1.11 2009/08/30 13:07:32 fredette Exp $ */
2 
3 /* tme/connection.h - public header file for connections: */
4 
5 /*
6  * Copyright (c) 2003 Matt Fredette
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by Matt Fredette.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _TME_CONNECTION_H
37 #define _TME_CONNECTION_H
38 
39 #include <tme/common.h>
40 _TME_RCSID("$Id: connection.h,v 1.11 2009/08/30 13:07:32 fredette Exp $");
41 
42 /* includes: */
43 #include <tme/element.h>
44 
45 /* macros: */
46 #define TME_CONNECTION_CLOSED	(0)
47 #define TME_CONNECTION_HALF	(1)
48 #define TME_CONNECTION_FULL	(2)
49 
50 /* structures: */
51 struct tme_element;
52 
53 /* one side of a connection: */
54 struct tme_connection {
55 
56   /* connection sides can be kept in a list: */
57   struct tme_connection *tme_connection_next;
58 
59   /* a backpointer to the element: */
60   struct tme_element *tme_connection_element;
61 
62   /* the element's identifier for this connection: */
63   tme_uint32_t tme_connection_id;
64 
65   /* the type of this connection: */
66   unsigned int tme_connection_type;
67 
68   /* the other side of the connection: */
69   struct tme_connection *tme_connection_other;
70 
71   /* the connection scoring function: */
72   int (*tme_connection_score) _TME_P((struct tme_connection *, unsigned int *));
73 
74   /* the connection making function: */
75   int (*tme_connection_make) _TME_P((struct tme_connection *, unsigned int));
76 
77   /* the connection breaking function: */
78   int (*tme_connection_break) _TME_P((struct tme_connection *, unsigned int));
79 };
80 
81 /* all connection types: */
82 #define TME_CONNECTION_BUS_GENERIC	(0)
83 #define TME_CONNECTION_BUS_M68K		(1)
84 #define TME_CONNECTION_SERIAL		(2)
85 #define TME_CONNECTION_ETHERNET		(3)
86 #define TME_CONNECTION_KEYBOARD		(4)
87 #define TME_CONNECTION_FRAMEBUFFER	(5)
88 #define TME_CONNECTION_SCSI		(6)
89 #define TME_CONNECTION_DISK		(7)
90 #define TME_CONNECTION_MOUSE		(8)
91 #define TME_CONNECTION_TAPE		(9)
92 #define TME_CONNECTION_BUS_SPARC	(10)
93 #define TME_CONNECTION_BUS_UPA		(11)
94 
95 #endif /* !_TME_CONNECTION_H */
96