Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66fc9390 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Update libnl++ class naming to match Android code style

nl::nlbuf -> nl::Buffer
nl::nlmsg -> nl::Message
nl::NetlinkRequest -> nl::MessageFactory
nl::NetlinkSocket -> nl::Socket

Bug: 162032964
Test: it builds
Change-Id: Id9858805ff3fce3e48f9a82b7dbaea09269bcb3c
parent 34eb83ae
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -20,8 +20,8 @@


#include <android-base/logging.h>
#include <android-base/logging.h>
#include <android-base/unique_fd.h>
#include <android-base/unique_fd.h>
#include <libnl++/NetlinkRequest.h>
#include <libnl++/MessageFactory.h>
#include <libnl++/NetlinkSocket.h>
#include <libnl++/Socket.h>


#include <linux/can.h>
#include <linux/can.h>
#include <linux/can/error.h>
#include <linux/can/error.h>
@@ -70,7 +70,7 @@ bool setBitrate(std::string ifname, uint32_t bitrate) {
    struct can_bittiming bt = {};
    struct can_bittiming bt = {};
    bt.bitrate = bitrate;
    bt.bitrate = bitrate;


    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);


    const auto ifidx = nametoindex(ifname);
    const auto ifidx = nametoindex(ifname);
    if (ifidx == 0) {
    if (ifidx == 0) {
@@ -90,7 +90,7 @@ bool setBitrate(std::string ifname, uint32_t bitrate) {
        }
        }
    }
    }


    nl::NetlinkSocket sock(NETLINK_ROUTE);
    nl::Socket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
    return sock.send(req) && sock.receiveAck();
}
}


+0 −2
Original line number Original line Diff line number Diff line
@@ -16,8 +16,6 @@


#pragma once
#pragma once


#include <libnl++/nlbuf.h>

#include <linux/can.h>
#include <linux/can.h>
#include <net/if.h>
#include <net/if.h>


+6 −6
Original line number Original line Diff line number Diff line
@@ -20,8 +20,8 @@
#include "ifreqs.h"
#include "ifreqs.h"


#include <android-base/logging.h>
#include <android-base/logging.h>
#include <libnl++/NetlinkRequest.h>
#include <libnl++/MessageFactory.h>
#include <libnl++/NetlinkSocket.h>
#include <libnl++/Socket.h>


#include <linux/can.h>
#include <linux/can.h>
#include <linux/rtnetlink.h>
#include <linux/rtnetlink.h>
@@ -62,7 +62,7 @@ bool down(std::string ifname) {
}
}


bool add(std::string dev, std::string type) {
bool add(std::string dev, std::string type) {
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK,
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    req.addattr(IFLA_IFNAME, dev);
    req.addattr(IFLA_IFNAME, dev);


@@ -71,15 +71,15 @@ bool add(std::string dev, std::string type) {
        req.addattr(IFLA_INFO_KIND, type);
        req.addattr(IFLA_INFO_KIND, type);
    }
    }


    nl::NetlinkSocket sock(NETLINK_ROUTE);
    nl::Socket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
    return sock.send(req) && sock.receiveAck();
}
}


bool del(std::string dev) {
bool del(std::string dev) {
    nl::NetlinkRequest<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
    nl::MessageFactory<struct ifinfomsg> req(RTM_DELLINK, NLM_F_REQUEST);
    req.addattr(IFLA_IFNAME, dev);
    req.addattr(IFLA_IFNAME, dev);


    nl::NetlinkSocket sock(NETLINK_ROUTE);
    nl::Socket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
    return sock.send(req) && sock.receiveAck();
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@
#include "common.h"
#include "common.h"


#include <android-base/logging.h>
#include <android-base/logging.h>
#include <libnl++/NetlinkRequest.h>
#include <libnl++/MessageFactory.h>
#include <libnl++/NetlinkSocket.h>
#include <libnl++/Socket.h>


#include <linux/rtnetlink.h>
#include <linux/rtnetlink.h>


@@ -33,7 +33,7 @@ bool add(const std::string& eth, const std::string& vlan, uint16_t id) {
        return false;
        return false;
    }
    }


    nl::NetlinkRequest<struct ifinfomsg> req(RTM_NEWLINK,
    nl::MessageFactory<struct ifinfomsg> req(RTM_NEWLINK,
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
                                             NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
    req.addattr(IFLA_IFNAME, vlan);
    req.addattr(IFLA_IFNAME, vlan);
    req.addattr<uint32_t>(IFLA_LINK, ethidx);
    req.addattr<uint32_t>(IFLA_LINK, ethidx);
@@ -48,7 +48,7 @@ bool add(const std::string& eth, const std::string& vlan, uint16_t id) {
        }
        }
    }
    }


    nl::NetlinkSocket sock(NETLINK_ROUTE);
    nl::Socket sock(NETLINK_ROUTE);
    return sock.send(req) && sock.receiveAck();
    return sock.send(req) && sock.receiveAck();
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -32,8 +32,8 @@ cc_library_static {
        "protocols/NetlinkProtocol.cpp",
        "protocols/NetlinkProtocol.cpp",
        "protocols/all.cpp",
        "protocols/all.cpp",
        "Attributes.cpp",
        "Attributes.cpp",
        "NetlinkRequest.cpp",
        "MessageFactory.cpp",
        "NetlinkSocket.cpp",
        "Socket.cpp",
        "common.cpp",
        "common.cpp",
        "printer.cpp",
        "printer.cpp",
    ],
    ],
Loading