probe libvirt.daemon.client.connect = process("libvirtd").mark("client_connect")
{
  fd = $arg1;
  readonly = $arg2;
  localAddr = user_string($arg3);
  remoteAddr = user_string($arg4);
}

probe libvirt.daemon.client.disconnect = process("libvirtd").mark("client_disconnect")
{
  fd = $arg1;
}


probe libvirt.daemon.client.tls_allow = process("libvirtd").mark("client_tls_allow")
{
  fd = $arg1;
  x509dname = user_string($arg2);
}

probe libvirt.daemon.client.tls_deny = process("libvirtd").mark("client_tls_deny")
{
  fd = $arg1;
  x509dname = user_string($arg2);
}

probe libvirt.daemon.client.tls_fail = process("libvirtd").mark("client_tls_fail")
{
  fd = $arg1;
}


function authtype_to_string(authtype) {
  if (authtype == 0)
    return "none"
  if (authtype == 1)
    return "sasl"
  if (authtype == 2)
    return "polkit"
  return "unknown"
}


probe libvirt.daemon.client.auth_allow = process("libvirtd").mark("client_auth_allow")
{
  fd = $arg1;
  authtype = $arg2;
  authname = authtype_to_string($arg2);
  identity = user_string($arg3);
}

probe libvirt.daemon.client.auth_deny = process("libvirtd").mark("client_auth_deny")
{
  fd = $arg1;
  authtype = $arg2;
  authname = authtype_to_string($arg2);
  identity = user_string($arg3);
}

probe libvirt.daemon.client.auth_fail = process("libvirtd").mark("client_auth_fail")
{
  fd = $arg1;
  authtype = $arg2;
  authname = authtype_to_string($arg2);
}
