-
Notifications
You must be signed in to change notification settings - Fork 30
/
internals.h
66 lines (51 loc) · 1.5 KB
/
internals.h
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
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved.
*
* Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
*
* This software licensed under GPL-2.0+, LGPL-2.0+
*/
#ifndef __NOZZLE_INTERNALS_H__
#define __NOZZLE_INTERNALS_H__
#include "config.h"
#include <net/if.h>
struct nozzle_lib_config {
struct nozzle_iface *head;
int ioctlfd;
};
#define IPADDR_CHAR_MAX 128
#define PREFIX_CHAR_MAX 4
struct nozzle_ip {
char ipaddr[IPADDR_CHAR_MAX];
char prefix[PREFIX_CHAR_MAX];
int domain; /* AF_INET or AF_INET6 */
struct nozzle_ip *next;
};
#define MACADDR_CHAR_MAX 18
/*
* 11 = post-down.d
* 1 = /
*/
#define UPDOWN_PATH_MAX PATH_MAX - 11 - 1 - IFNAMSIZ
struct nozzle_iface {
char name[IFNAMSIZ]; /* interface name */
int fd; /* interface fd */
int up; /* interface status 0 is down, 1 is up */
/*
* extra data
*/
struct nozzle_ip *ip; /* configured ip addresses */
/*
* default MAC address assigned by the kernel at creation time
*/
char default_mac[MACADDR_CHAR_MAX];
int default_mtu; /* MTU assigned by the kernel at creation time */
int current_mtu; /* MTU configured by libnozzle user */
int hasupdown; /* interface has up/down path to scripts configured */
char updownpath[UPDOWN_PATH_MAX]; /* path to up/down scripts if configured */
struct nozzle_iface *next;
};
#define ifname ifr.ifr_name
int execute_shell_command(const char *command, char **error_string);
int run_updown(const nozzle_t nozzle, const char *action, char **error_string);
#endif