Debian Codegraph @

lib/csharp/MonoExample/NDesk-dbus/Transport.cs

raw
1 // Copyright 2006 Alp Toker <[email protected]>
2 // This software is made available under the MIT License
3 // See COPYING for details
4
5 using System;
6 using System.IO;
7
8 namespace NDesk.DBus.Transports
9 {
10 abstract class Transport
11 {
12 public static Transport Create (AddressEntry entry)
13 {
14 switch (entry.Method) {
15 case "tcp":
16 {
17 Transport transport = new SocketTransport ();
18 transport.Open (entry);
19 return transport;
20 }
21 #if !PORTABLE
22 case "unix":
23 {
24 //Transport transport = new UnixMonoTransport ();
25 Transport transport = new UnixNativeTransport ();
26 transport.Open (entry);
27 return transport;
28 }
29 #endif
30 default:
31 throw new NotSupportedException ("Transport method \"" + entry.Method + "\" not supported");
32 }
33 }
34
35 protected Connection connection;
36
37 public Connection Connection
38 {
39 get {
40 return connection;
41 } set {
42 connection = value;
43 }
44 }
45
46 //TODO: design this properly
47
48 //this is just a temporary solution
49 public Stream Stream;
50 public long SocketHandle;
51 public abstract void Open (AddressEntry entry);
52 public abstract string AuthString ();
53 public abstract void WriteCred ();
54 }
55 }