~phablet-team/aethercast/fix-for-microsoft-dongle

« back to all changes in this revision

Viewing changes to src/w11tng/netlinklistener.h

  • Committer: Tarmac
  • Author(s): Simon Fels
  • Date: 2016-03-04 14:14:09 UTC
  • mfrom: (119.4.12 ac-networking-fixes)
  • Revision ID: tarmac-20160304141409-xe8khdgb43nha1fn
Multiple changes for Networking support:

* Add a DisconnectAll dbus method to allow the UI to easily disconnect
  any connected device. Just for the purpose of a demo.
* Return proper errors when scanning fails.
* Enable miracast mode for the WiFi driver if available.
* Set GO intent by default to 7. Should be higher if we're a sink.
* Print frequencies consider for GO negotiation
* Several minor fixes
* Enable unit tests again.

Approved by PS Jenkins bot, Thomas Voß.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2015 Canonical, Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3, as published
6
 
 * by the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
10
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
 
 * PURPOSE.  See the GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License along
14
 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 */
17
 
 
18
 
#ifndef W11TNG_NETLINK_LISTENER_H_
19
 
#define W11TNG_NETLINK_LISTENER_H_
20
 
 
21
 
#include <glib.h>
22
 
 
23
 
#include <memory>
24
 
 
25
 
#include <mcs/non_copyable.h>
26
 
#include <mcs/scoped_gobject.h>
27
 
 
28
 
struct nlmsghdr;
29
 
 
30
 
namespace w11tng {
31
 
 
32
 
class NetlinkListener : public std::enable_shared_from_this<NetlinkListener> {
33
 
public:
34
 
    typedef std::shared_ptr<NetlinkListener> Ptr;
35
 
 
36
 
    class Delegate : public mcs::NonCopyable {
37
 
    public:
38
 
        virtual void OnInterfaceAddressChanged(const std::string &interface, const std::string &address) { }
39
 
    };
40
 
 
41
 
    static Ptr Create(const std::weak_ptr<Delegate> &delegate);
42
 
 
43
 
    ~NetlinkListener();
44
 
 
45
 
    void SetInterfaceFilter(const std::string &interface_name);
46
 
 
47
 
private:
48
 
    NetlinkListener(const std::weak_ptr<Delegate> &delegate);
49
 
    Ptr FinalizeConstruction();
50
 
 
51
 
    void ProcessNewAddress(struct nlmsghdr *hdr);
52
 
 
53
 
private:
54
 
    static gboolean OnDataAvailable(GIOChannel *channel, GIOCondition condition, gpointer user_data);
55
 
 
56
 
private:
57
 
    const std::weak_ptr<Delegate> delegate_;
58
 
    GIOChannel *channel_;
59
 
    int interface_index_filter_;
60
 
};
61
 
 
62
 
} // namespace w11tng
63
 
 
64
 
#endif