4
// Andrzej Wytyczak-Partyka <iapart@gmail.com>
5
// James Willcox <snorp@snorp.net>
7
// Copyright (C) 2008 Andrzej Wytyczak-Partyka
8
// Copyright (C) 2005 James Willcox <snorp@snorp.net>
10
// This program is free software; you can redistribute it and/or modify
11
// it under the terms of the GNU General Public License as published by
12
// the Free Software Foundation; either version 2 of the License, or
13
// (at your option) any later version.
15
// This program is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU General Public License for more details.
20
// You should have received a copy of the GNU General Public License
21
// along with this program; if not, write to the Free Software
22
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33
public enum AuthenticationMethod : byte {
39
internal class ServerInfo {
42
private AuthenticationMethod auth_method;
43
private bool supports_update;
50
public AuthenticationMethod AuthenticationMethod {
51
get { return auth_method; }
52
set { auth_method = value; }
55
public bool SupportsUpdate {
56
get { return supports_update; }
57
set { supports_update = value; }
60
internal static ServerInfo FromNode (ContentNode node) {
61
ServerInfo info = new ServerInfo ();
63
if (node.Name != "dmap.serverinforesponse")
66
foreach (ContentNode child in (node.Value as ContentNode [])) {
69
info.Name = (string) child.Value;
71
case "dmap.authenticationmethod":
72
info.AuthenticationMethod = (AuthenticationMethod) child.Value;
74
case "dmap.supportsupdate":
75
info.SupportsUpdate = (byte) child.Value == 1;
83
internal ContentNode ToNode (int dbCount) {
84
return new ContentNode ("dmap.serverinforesponse",
85
new ContentNode ("dmap.status", 200),
86
new ContentNode ("dmap.protocolversion", new Version (2, 0, 0)),
87
new ContentNode ("dpap.protocolversion", new Version (1, 0, 1)),
88
new ContentNode ("dmap.itemname", "photos"),
89
new ContentNode ("dmap.loginrequired", (byte) 1),
90
// new ContentNode ("dmap.authenticationmethod", (byte) auth_method),
91
new ContentNode ("dmap.timeoutinterval", (int) Server.DefaultTimeout.TotalSeconds),
92
new ContentNode ("dmap.supportsautologout", (byte) 1),
93
// new ContentNode ("dmap.supportsupdate", (byte) 1),
94
// new ContentNode ("dmap.supportspersistentids", (byte) 1),
95
// new ContentNode ("dmap.supportsextensions", (byte) 1),
96
// new ContentNode ("dmap.supportsbrowse", (byte) 1),
97
// new ContentNode ("dmap.supportsquery", (byte) 1),
98
new ContentNode ("dmap.supportsindex", (byte) 1),
99
// new ContentNode ("dmap.supportsresolve", (byte) 0),
100
new ContentNode ("dmap.databasescount", dbCount));