use crate::_doc::{guide, linklist, man7, manbsd, stdlinks};
use crate::constants::{AuthnFlags, AuthtokFlags, Result};
use crate::conv::Conversation;
use crate::environ::{EnvironMap, EnvironMapMut};
use crate::items::{getter, Items, ItemsMut};
use crate::logging::Logger;
use std::ffi::{OsStr, OsString};
pub trait PamShared: Logger {
#[doc = linklist!(pam_getenv: adg, mwg, _std)]
#[doc = stdlinks!(3 pam_getenv)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_getenv")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#adg-pam_getenv")]
fn environ(&self) -> impl EnvironMap;
#[doc = linklist!(pam_putenv: adg, mwg, _std)]
#[doc = stdlinks!(3 pam_putenv)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_putenv")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#adg-pam_putenv")]
fn environ_mut(&mut self) -> impl EnvironMapMut;
#[doc = linklist!(pam_get_item: mwg, adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_get_item")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_get_item")]
#[doc = stdlinks!(3 pam_get_item)]
fn items(&self) -> impl Items;
#[doc = linklist!(pam_set_item: mwg, adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_set_item")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_set_item")]
#[doc = stdlinks!(3 pam_set_item)]
fn items_mut(&mut self) -> impl ItemsMut;
}
pub trait Transaction: PamShared {
#[doc = linklist!(pam_authenticate: adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_authenticate")]
#[doc = stdlinks!(3 pam_authenticate)]
fn authenticate(&mut self, flags: AuthnFlags) -> Result<()>;
#[doc = linklist!(pam_acct_mgmt: adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_acct_mgmt")]
#[doc = stdlinks!(3 pam_acct_mgmt)]
fn account_management(&mut self, flags: AuthnFlags) -> Result<()>;
#[doc = linklist!(pam_chauthtok: adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_chauthtok")]
#[doc = stdlinks!(3 pam_chauthtok)]
fn change_authtok(&mut self, flags: AuthtokFlags) -> Result<()>;
}
pub trait ModuleClient: Conversation + PamShared {
#[doc = linklist!(pam_get_user: mwg, _std)]
#[doc = stdlinks!(3 pam_get_user)]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_get_user")]
fn username(&mut self, prompt: Option<&OsStr>) -> Result<OsString>;
#[doc = linklist!(pam_get_authtok: man7, manbsd)]
#[doc = man7!(3 pam_get_authtok)]
#[doc = manbsd!(3 pam_get_authtok)]
fn authtok(&mut self, prompt: Option<&OsStr>) -> Result<OsString>;
#[doc = linklist!(pam_get_authtok: man7, manbsd)]
#[doc = stdlinks!(3 pam_get_authtok)]
fn old_authtok(&mut self, prompt: Option<&OsStr>) -> Result<OsString>;
#[doc = linklist!(pam_get_data: mwg, _std)]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_get_data")]
#[doc = stdlinks!(3 pam_get_data)]
fn get_module_data<T: 'static>(&self, key: &str) -> Option<&T>;
#[doc = linklist!(pam_set_data: mwg, _std)]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_set_data")]
#[doc = stdlinks!(3 pam_set_data)]
fn set_module_data<T: 'static>(&mut self, key: &str, data: T) -> Result<()>;
getter!(
#[doc = linklist!(pam_set_item: mwg, adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_set_item")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_set_item")]
#[doc = stdlinks!(3 pam_set_item)]
authtok_item("PAM_AUTHTOK", see = Self::authtok)
);
getter!(
#[doc = linklist!(pam_set_item: mwg, adg, _std)]
#[doc = guide!(adg: "adg-interface-by-app-expected.html#adg-pam_set_item")]
#[doc = guide!(mwg: "mwg-expected-by-module-item.html#mwg-pam_set_item")]
#[doc = stdlinks!(3 pam_set_item)]
old_authtok_item("PAM_OLDAUTHTOK", see = ItemsMut::set_old_authtok)
);
}