Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define some contants necessary to access types/settings maps etc #22

Open
ijc opened this issue Apr 28, 2021 · 1 comment
Open

Define some contants necessary to access types/settings maps etc #22

ijc opened this issue Apr 28, 2021 · 1 comment

Comments

@ijc
Copy link

ijc commented Apr 28, 2021

The C library has a bunch of #defines for keys used in various maps. e.g. from nm-setting-wireless.h:

#define NM_SETTING_WIRELESS_SETTING_NAME "802-11-wireless"

...

#define NM_SETTING_WIRELESS_SSID                      "ssid"
#define NM_SETTING_WIRELESS_MODE                      "mode"
#define NM_SETTING_WIRELESS_BAND                      "band"
#define NM_SETTING_WIRELESS_CHANNEL                   "channel"
#define NM_SETTING_WIRELESS_BSSID                     "bssid"

Could these bindings define a similar set of Go consts to reduce the possibility of typos? Or would specific getter methods be more appropriate?

There are also various defines and enums etc for values, such as:

#define NM_SETTING_WIRELESS_MODE_ADHOC "adhoc"

....

typedef enum {                                                            /*< flags >*/
    NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE                 = 0, /*< skip >*/
    NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY                  = 0x2,
    NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT           = 0x4,
    NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC                = 0x8,
...
} NMSettingWirelessWakeOnWLan;

There are lots of nm-setting-*.h though and it would be a lot to maintain all of them, but perhaps ad-hoc/as needed coverage could be acceptable?

@everactivemilligan
Copy link

Something like this might ease the burden:

https://github.com/elliotchance/c2go

We have used it in the past to "import" some headers w/ defines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants