1<?php
2/**
3 * Copyright 2014-2016 Horde LLC (http://www.horde.org/)
4 *
5 * See the enclosed file COPYING for license information (LGPL). If you
6 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
7 *
8 * @category  Horde
9 * @copyright 2014-2016 Horde LLC
10 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
11 * @package   Mail_Autoconfig
12 */
13
14/**
15 * Autoconfigured configuration details for a server.
16 *
17 * @author    Michael Slusarz <slusarz@horde.org>
18 * @category  Horde
19 * @copyright 2014-2016 Horde LLC
20 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
21 * @package   Mail_Autoconfig
22 */
23abstract class Horde_Mail_Autoconfig_Server
24{
25    /**
26     * The server hostname (IDN encoded).
27     *
28     * @var string
29     */
30    public $host = null;
31
32    /**
33     * The server port.
34     *
35     * @var integer
36     */
37    public $port = null;
38
39    /**
40     * The server label.
41     *
42     * @var integer
43     */
44    public $label = null;
45
46    /**
47     * TLS connection details.
48     *
49     * 'tls' = TLS needed for direct connection to server/port.
50     * 'starttls' = Switch to TLS via protocol after connection.
51     * false = No TLS connection used.
52     *
53     * @var mixed
54     */
55    public $tls = null;
56
57    /**
58     * The username to use.
59     *
60     * @var string
61     */
62    public $username = null;
63
64    /**
65     * Check to see if server can be connected to.
66     *
67     * @param array $opts  Additional options:
68     *   - auth: (mixed) The authentication credentials used to test a
69     *           successful connection.
70     *   - insecure: (boolean) If true, will attempt insecure authentication.
71     *   - users: (array) A list of usernames to attempt if trying auth. If
72     *            successful, the username will be stored in $username.
73     *
74     * @return boolean  True if server is valid.
75     */
76    abstract public function valid(array $opts = array());
77
78}
79