| 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 |
using Mono.Unix; |
| 8 |
|
| 9 |
namespace NDesk.DBus.Transports |
| 10 |
{ |
| 11 |
abstract class UnixTransport : Transport |
| 12 |
{ |
| 13 |
public override void Open (AddressEntry entry) |
| 14 |
{ |
| 15 |
string path; |
| 16 |
bool abstr; |
| 17 |
|
| 18 |
if (entry.Properties.TryGetValue ("path", out path)) |
| 19 |
abstr = false; |
| 20 |
else if (entry.Properties.TryGetValue ("abstract", out path)) |
| 21 |
abstr = true; |
| 22 |
else |
| 23 |
throw new Exception ("No path specified for UNIX transport"); |
| 24 |
|
| 25 |
Open (path, abstr); |
| 26 |
} |
| 27 |
|
| 28 |
public override string AuthString () |
| 29 |
{ |
| 30 |
long uid = UnixUserInfo.GetRealUserId (); |
| 31 |
|
| 32 |
return uid.ToString (); |
| 33 |
} |
| 34 |
|
| 35 |
public abstract void Open (string path, bool @abstract); |
| 36 |
} |
| 37 |
} |