Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit 06afc08

Browse files
Add more Tls bindings
1 parent 12c1c5e commit 06afc08

File tree

8 files changed

+1252
-0
lines changed

8 files changed

+1252
-0
lines changed

Gir.toml

+23
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,18 @@ generate = [
5959
"Gio.NetworkAddress",
6060
"Gio.NetworkService",
6161
"Gio.ThemedIcon",
62+
"Gio.TlsAuthenticationMode",
6263
"Gio.TlsCertificate",
6364
"Gio.TlsCertificateFlags",
65+
"Gio.TlsCertificateRequestFlags",
66+
"Gio.TlsConnection",
67+
"Gio.TlsDatabase",
68+
"Gio.TlsDatabaseLookupFlags",
69+
"Gio.TlsDatabaseVerifyFlags",
70+
"Gio.TlsInteraction",
71+
"Gio.TlsInteractionResult",
72+
"Gio.TlsPasswordFlags",
73+
"Gio.TlsRehandshakeMode",
6474
]
6575

6676
ignore = [
@@ -450,3 +460,16 @@ status = "generate"
450460
name = "Gio.SettingsSchemaKey"
451461
status = "generate"
452462
version = "2.40"
463+
464+
[[object]]
465+
name = "Gio.TlsPassword"
466+
status = "generate"
467+
[[object.function]]
468+
name = "get_value"
469+
# missing inout annotation
470+
ignore = true
471+
472+
[[object.function]]
473+
# missing (element-type guint8) annotation
474+
name = "set_value"
475+
ignore = true

src/auto/enums.rs

+293
Original file line numberDiff line numberDiff line change
@@ -874,3 +874,296 @@ impl SetValue for SocketType {
874874
}
875875
}
876876

877+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
878+
pub enum TlsAuthenticationMode {
879+
None,
880+
Requested,
881+
Required,
882+
#[doc(hidden)]
883+
__Unknown(i32),
884+
}
885+
886+
#[doc(hidden)]
887+
impl ToGlib for TlsAuthenticationMode {
888+
type GlibType = ffi::GTlsAuthenticationMode;
889+
890+
fn to_glib(&self) -> ffi::GTlsAuthenticationMode {
891+
match *self {
892+
TlsAuthenticationMode::None => ffi::G_TLS_AUTHENTICATION_NONE,
893+
TlsAuthenticationMode::Requested => ffi::G_TLS_AUTHENTICATION_REQUESTED,
894+
TlsAuthenticationMode::Required => ffi::G_TLS_AUTHENTICATION_REQUIRED,
895+
TlsAuthenticationMode::__Unknown(value) => value
896+
}
897+
}
898+
}
899+
900+
#[doc(hidden)]
901+
impl FromGlib<ffi::GTlsAuthenticationMode> for TlsAuthenticationMode {
902+
fn from_glib(value: ffi::GTlsAuthenticationMode) -> Self {
903+
match value {
904+
0 => TlsAuthenticationMode::None,
905+
1 => TlsAuthenticationMode::Requested,
906+
2 => TlsAuthenticationMode::Required,
907+
value => TlsAuthenticationMode::__Unknown(value),
908+
}
909+
}
910+
}
911+
912+
impl StaticType for TlsAuthenticationMode {
913+
fn static_type() -> Type {
914+
unsafe { from_glib(ffi::g_tls_authentication_mode_get_type()) }
915+
}
916+
}
917+
918+
impl<'a> FromValueOptional<'a> for TlsAuthenticationMode {
919+
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
920+
Some(FromValue::from_value(value))
921+
}
922+
}
923+
924+
impl<'a> FromValue<'a> for TlsAuthenticationMode {
925+
unsafe fn from_value(value: &Value) -> Self {
926+
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
927+
}
928+
}
929+
930+
impl SetValue for TlsAuthenticationMode {
931+
unsafe fn set_value(value: &mut Value, this: &Self) {
932+
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
933+
}
934+
}
935+
936+
#[cfg(any(feature = "v2_40", feature = "dox"))]
937+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
938+
pub enum TlsCertificateRequestFlags {
939+
None,
940+
#[doc(hidden)]
941+
__Unknown(i32),
942+
}
943+
944+
#[cfg(any(feature = "v2_40", feature = "dox"))]
945+
#[doc(hidden)]
946+
impl ToGlib for TlsCertificateRequestFlags {
947+
type GlibType = ffi::GTlsCertificateRequestFlags;
948+
949+
fn to_glib(&self) -> ffi::GTlsCertificateRequestFlags {
950+
match *self {
951+
TlsCertificateRequestFlags::None => ffi::G_TLS_CERTIFICATE_REQUEST_NONE,
952+
TlsCertificateRequestFlags::__Unknown(value) => value
953+
}
954+
}
955+
}
956+
957+
#[cfg(any(feature = "v2_40", feature = "dox"))]
958+
#[doc(hidden)]
959+
impl FromGlib<ffi::GTlsCertificateRequestFlags> for TlsCertificateRequestFlags {
960+
fn from_glib(value: ffi::GTlsCertificateRequestFlags) -> Self {
961+
match value {
962+
0 => TlsCertificateRequestFlags::None,
963+
value => TlsCertificateRequestFlags::__Unknown(value),
964+
}
965+
}
966+
}
967+
968+
#[cfg(any(feature = "v2_40", feature = "dox"))]
969+
impl StaticType for TlsCertificateRequestFlags {
970+
fn static_type() -> Type {
971+
unsafe { from_glib(ffi::g_tls_certificate_request_flags_get_type()) }
972+
}
973+
}
974+
975+
#[cfg(any(feature = "v2_40", feature = "dox"))]
976+
impl<'a> FromValueOptional<'a> for TlsCertificateRequestFlags {
977+
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
978+
Some(FromValue::from_value(value))
979+
}
980+
}
981+
982+
#[cfg(any(feature = "v2_40", feature = "dox"))]
983+
impl<'a> FromValue<'a> for TlsCertificateRequestFlags {
984+
unsafe fn from_value(value: &Value) -> Self {
985+
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
986+
}
987+
}
988+
989+
#[cfg(any(feature = "v2_40", feature = "dox"))]
990+
impl SetValue for TlsCertificateRequestFlags {
991+
unsafe fn set_value(value: &mut Value, this: &Self) {
992+
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
993+
}
994+
}
995+
996+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
997+
pub enum TlsDatabaseLookupFlags {
998+
None,
999+
Keypair,
1000+
#[doc(hidden)]
1001+
__Unknown(i32),
1002+
}
1003+
1004+
#[doc(hidden)]
1005+
impl ToGlib for TlsDatabaseLookupFlags {
1006+
type GlibType = ffi::GTlsDatabaseLookupFlags;
1007+
1008+
fn to_glib(&self) -> ffi::GTlsDatabaseLookupFlags {
1009+
match *self {
1010+
TlsDatabaseLookupFlags::None => ffi::G_TLS_DATABASE_LOOKUP_NONE,
1011+
TlsDatabaseLookupFlags::Keypair => ffi::G_TLS_DATABASE_LOOKUP_KEYPAIR,
1012+
TlsDatabaseLookupFlags::__Unknown(value) => value
1013+
}
1014+
}
1015+
}
1016+
1017+
#[doc(hidden)]
1018+
impl FromGlib<ffi::GTlsDatabaseLookupFlags> for TlsDatabaseLookupFlags {
1019+
fn from_glib(value: ffi::GTlsDatabaseLookupFlags) -> Self {
1020+
match value {
1021+
0 => TlsDatabaseLookupFlags::None,
1022+
1 => TlsDatabaseLookupFlags::Keypair,
1023+
value => TlsDatabaseLookupFlags::__Unknown(value),
1024+
}
1025+
}
1026+
}
1027+
1028+
impl StaticType for TlsDatabaseLookupFlags {
1029+
fn static_type() -> Type {
1030+
unsafe { from_glib(ffi::g_tls_database_lookup_flags_get_type()) }
1031+
}
1032+
}
1033+
1034+
impl<'a> FromValueOptional<'a> for TlsDatabaseLookupFlags {
1035+
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
1036+
Some(FromValue::from_value(value))
1037+
}
1038+
}
1039+
1040+
impl<'a> FromValue<'a> for TlsDatabaseLookupFlags {
1041+
unsafe fn from_value(value: &Value) -> Self {
1042+
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1043+
}
1044+
}
1045+
1046+
impl SetValue for TlsDatabaseLookupFlags {
1047+
unsafe fn set_value(value: &mut Value, this: &Self) {
1048+
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
1049+
}
1050+
}
1051+
1052+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
1053+
pub enum TlsInteractionResult {
1054+
Unhandled,
1055+
Handled,
1056+
Failed,
1057+
#[doc(hidden)]
1058+
__Unknown(i32),
1059+
}
1060+
1061+
#[doc(hidden)]
1062+
impl ToGlib for TlsInteractionResult {
1063+
type GlibType = ffi::GTlsInteractionResult;
1064+
1065+
fn to_glib(&self) -> ffi::GTlsInteractionResult {
1066+
match *self {
1067+
TlsInteractionResult::Unhandled => ffi::G_TLS_INTERACTION_UNHANDLED,
1068+
TlsInteractionResult::Handled => ffi::G_TLS_INTERACTION_HANDLED,
1069+
TlsInteractionResult::Failed => ffi::G_TLS_INTERACTION_FAILED,
1070+
TlsInteractionResult::__Unknown(value) => value
1071+
}
1072+
}
1073+
}
1074+
1075+
#[doc(hidden)]
1076+
impl FromGlib<ffi::GTlsInteractionResult> for TlsInteractionResult {
1077+
fn from_glib(value: ffi::GTlsInteractionResult) -> Self {
1078+
match value {
1079+
0 => TlsInteractionResult::Unhandled,
1080+
1 => TlsInteractionResult::Handled,
1081+
2 => TlsInteractionResult::Failed,
1082+
value => TlsInteractionResult::__Unknown(value),
1083+
}
1084+
}
1085+
}
1086+
1087+
impl StaticType for TlsInteractionResult {
1088+
fn static_type() -> Type {
1089+
unsafe { from_glib(ffi::g_tls_interaction_result_get_type()) }
1090+
}
1091+
}
1092+
1093+
impl<'a> FromValueOptional<'a> for TlsInteractionResult {
1094+
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
1095+
Some(FromValue::from_value(value))
1096+
}
1097+
}
1098+
1099+
impl<'a> FromValue<'a> for TlsInteractionResult {
1100+
unsafe fn from_value(value: &Value) -> Self {
1101+
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1102+
}
1103+
}
1104+
1105+
impl SetValue for TlsInteractionResult {
1106+
unsafe fn set_value(value: &mut Value, this: &Self) {
1107+
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
1108+
}
1109+
}
1110+
1111+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
1112+
pub enum TlsRehandshakeMode {
1113+
Never,
1114+
Safely,
1115+
Unsafely,
1116+
#[doc(hidden)]
1117+
__Unknown(i32),
1118+
}
1119+
1120+
#[doc(hidden)]
1121+
impl ToGlib for TlsRehandshakeMode {
1122+
type GlibType = ffi::GTlsRehandshakeMode;
1123+
1124+
fn to_glib(&self) -> ffi::GTlsRehandshakeMode {
1125+
match *self {
1126+
TlsRehandshakeMode::Never => ffi::G_TLS_REHANDSHAKE_NEVER,
1127+
TlsRehandshakeMode::Safely => ffi::G_TLS_REHANDSHAKE_SAFELY,
1128+
TlsRehandshakeMode::Unsafely => ffi::G_TLS_REHANDSHAKE_UNSAFELY,
1129+
TlsRehandshakeMode::__Unknown(value) => value
1130+
}
1131+
}
1132+
}
1133+
1134+
#[doc(hidden)]
1135+
impl FromGlib<ffi::GTlsRehandshakeMode> for TlsRehandshakeMode {
1136+
fn from_glib(value: ffi::GTlsRehandshakeMode) -> Self {
1137+
match value {
1138+
0 => TlsRehandshakeMode::Never,
1139+
1 => TlsRehandshakeMode::Safely,
1140+
2 => TlsRehandshakeMode::Unsafely,
1141+
value => TlsRehandshakeMode::__Unknown(value),
1142+
}
1143+
}
1144+
}
1145+
1146+
impl StaticType for TlsRehandshakeMode {
1147+
fn static_type() -> Type {
1148+
unsafe { from_glib(ffi::g_tls_rehandshake_mode_get_type()) }
1149+
}
1150+
}
1151+
1152+
impl<'a> FromValueOptional<'a> for TlsRehandshakeMode {
1153+
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
1154+
Some(FromValue::from_value(value))
1155+
}
1156+
}
1157+
1158+
impl<'a> FromValue<'a> for TlsRehandshakeMode {
1159+
unsafe fn from_value(value: &Value) -> Self {
1160+
from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0))
1161+
}
1162+
}
1163+
1164+
impl SetValue for TlsRehandshakeMode {
1165+
unsafe fn set_value(value: &mut Value, this: &Self) {
1166+
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
1167+
}
1168+
}
1169+

0 commit comments

Comments
 (0)