summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VirtualBox/src/networkmanager/UINetworkManagerUtils.h
blob: 0e00318bcb84b160d50d8f557c5bf22cf9a2df05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* $Id$ */
/** @file
 * VBox Qt GUI - UINetworkManagerUtils namespace declaration.
 */

/*
 * Copyright (C) 2017-2022 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) as published by the Free Software
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef FEQT_INCLUDED_SRC_networkmanager_UINetworkManagerUtils_h
#define FEQT_INCLUDED_SRC_networkmanager_UINetworkManagerUtils_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif

/* Qt includes: */
#include <QStringList>


/** Network Manager: Host network utilities. */
namespace UINetworkManagerUtils
{
    /** Converts IPv4 address from QString to quint32. */
    quint32 ipv4FromQStringToQuint32(const QString &strAddress);
    /** Converts IPv4 address from quint32 to QString. */
    QString ipv4FromQuint32ToQString(quint32 uAddress);

    /** Increments network @a uAddress by 1 avoiding 0/255 values. */
    quint32 incrementNetworkAddress(quint32 uAddress);
    /** Decrements network @a uAddress by 1 avoiding 0/255 values. */
    quint32 decrementNetworkAddress(quint32 uAddress);
    /** Advances network @a uAddress by 1 avoiding 0/255 values.
      * @param  fForward  Brings whether advance should
      *                   go forward or backward otherwise. */
    quint32 advanceNetworkAddress(quint32 uAddress, bool fForward);

    /** Calculates DHCP server proposal on the basis of the passed @a strInterfaceAddress and @a strInterfaceMask. */
    QStringList makeDhcpServerProposal(const QString &strInterfaceAddress, const QString &strInterfaceMask);
}

/* Using this namespace where included: */
using namespace UINetworkManagerUtils;

#endif /* !FEQT_INCLUDED_SRC_networkmanager_UINetworkManagerUtils_h */