1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2017 Red Hat, Inc.
4 */
5
6#ifndef __NM_SETTING_MACSEC_H__
7#define __NM_SETTING_MACSEC_H__
8
9#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
10#error "Only <NetworkManager.h> can be included directly."
11#endif
12
13#include "nm-setting.h"
14
15G_BEGIN_DECLS
16
17#define NM_TYPE_SETTING_MACSEC (nm_setting_macsec_get_type())
18#define NM_SETTING_MACSEC(obj) \
19 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_MACSEC, NMSettingMacsec))
20#define NM_SETTING_MACSEC_CLASS(klass) \
21 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_MACSECCONFIG, NMSettingMacsecClass))
22#define NM_IS_SETTING_MACSEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_MACSEC))
23#define NM_IS_SETTING_MACSEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_MACSEC))
24#define NM_SETTING_MACSEC_GET_CLASS(obj) \
25 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_MACSEC, NMSettingMacsecClass))
26
27#define NM_SETTING_MACSEC_SETTING_NAME "macsec"
28
29#define NM_SETTING_MACSEC_PARENT "parent"
30#define NM_SETTING_MACSEC_MODE "mode"
31#define NM_SETTING_MACSEC_ENCRYPT "encrypt"
32#define NM_SETTING_MACSEC_MKA_CAK "mka-cak"
33#define NM_SETTING_MACSEC_MKA_CAK_FLAGS "mka-cak-flags"
34#define NM_SETTING_MACSEC_MKA_CKN "mka-ckn"
35#define NM_SETTING_MACSEC_PORT "port"
36#define NM_SETTING_MACSEC_VALIDATION "validation"
37#define NM_SETTING_MACSEC_SEND_SCI "send-sci"
38
39typedef struct _NMSettingMacsecClass NMSettingMacsecClass;
40
41/**
42 * NMSettingMacsecMode:
43 * @NM_SETTING_MACSEC_MODE_PSK: The CAK is pre-shared
44 * @NM_SETTING_MACSEC_MODE_EAP: The CAK is the result of participation in EAP
45 *
46 * #NMSettingMacsecMode controls how the CAK (Connectivity Association Key) used
47 * in MKA (MACsec Key Agreement) is obtained.
48 *
49 * Since: 1.6
50 */
51typedef enum {
52 NM_SETTING_MACSEC_MODE_PSK = 0,
53 NM_SETTING_MACSEC_MODE_EAP = 1,
54} NMSettingMacsecMode;
55
56/**
57 * NMSettingMacsecValidation:
58 * @NM_SETTING_MACSEC_VALIDATION_DISABLE: All incoming frames are accepted if
59 * possible
60 * @NM_SETTING_MACSEC_VALIDATION_CHECK: Non protected, invalid, or impossible to
61 * verify frames are accepted and counted as "invalid"
62 * @NM_SETTING_MACSEC_VALIDATION_STRICT: Non protected, invalid, or impossible to
63 * verify frames are dropped
64 *
65 * #NMSettingMacsecValidation specifies a validation mode for incoming frames.
66 *
67 * Since: 1.6
68 */
69typedef enum {
70 NM_SETTING_MACSEC_VALIDATION_DISABLE = 0,
71 NM_SETTING_MACSEC_VALIDATION_CHECK = 1,
72 NM_SETTING_MACSEC_VALIDATION_STRICT = 2,
73} NMSettingMacsecValidation;
74
75#define NM_SETTING_MACSEC_MKA_CAK_LENGTH 32
76#define NM_SETTING_MACSEC_MKA_CKN_LENGTH 64
77
78NM_AVAILABLE_IN_1_6
79GType nm_setting_macsec_get_type(void);
80NM_AVAILABLE_IN_1_6
81NMSetting *nm_setting_macsec_new(void);
82
83NM_AVAILABLE_IN_1_6
84const char *nm_setting_macsec_get_parent(NMSettingMacsec *setting);
85NM_AVAILABLE_IN_1_6
86NMSettingMacsecMode nm_setting_macsec_get_mode(NMSettingMacsec *setting);
87NM_AVAILABLE_IN_1_6
88gboolean nm_setting_macsec_get_encrypt(NMSettingMacsec *setting);
89NM_AVAILABLE_IN_1_6
90const char *nm_setting_macsec_get_mka_cak(NMSettingMacsec *setting);
91NM_AVAILABLE_IN_1_6
92NMSettingSecretFlags nm_setting_macsec_get_mka_cak_flags(NMSettingMacsec *setting);
93NM_AVAILABLE_IN_1_6
94const char *nm_setting_macsec_get_mka_ckn(NMSettingMacsec *setting);
95NM_AVAILABLE_IN_1_6
96int nm_setting_macsec_get_port(NMSettingMacsec *setting);
97NM_AVAILABLE_IN_1_6
98NMSettingMacsecValidation nm_setting_macsec_get_validation(NMSettingMacsec *setting);
99NM_AVAILABLE_IN_1_12
100gboolean nm_setting_macsec_get_send_sci(NMSettingMacsec *setting);
101
102G_END_DECLS
103
104#endif /* __NM_SETTING_MACSEC_H__ */
105

source code of include/libnm/nm-setting-macsec.h