Home | History | Annotate | Line # | Download | only in global
      1 /*	$NetBSD: pol_stats.h,v 1.2 2026/05/09 18:49:16 christos Exp $	*/
      2 
      3 #ifndef _POL_STATS_H_INCLUDED_
      4 #define _POL_STATS_H_INCLUDED_
      5 
      6 /*++
      7 /* NAME
      8 /*	tls_stats 3h
      9 /* SUMMARY
     10 /*	manage TLS per-feature policy compliance status
     11 /* SYNOPSIS
     12 /*	#include <pol_stats.h>
     13 /* DESCRIPTION
     14 /* .nf
     15 
     16  /*
     17   * Utility library.
     18   */
     19 #include <vstring.h>
     20 
     21  /*
     22   * External interface.
     23   */
     24 typedef struct POL_STAT {
     25     const char *init_name;		/* Human-readable feature name */
     26     const char *final_name;		/* Human-readable feature name */
     27     int     status;			/* See below */
     28 } POL_STAT;
     29 
     30 #define POL_STAT_INACTIVE	0	/* No data */
     31 #define POL_STAT_UNDECIDED	1	/* Pending decision */
     32 #define POL_STAT_VIOLATION	2	/* Definitely did not meet policy */
     33 #define POL_STAT_COMPLIANT	3	/* Definitely did meet policy */
     34 
     35  /*
     36   * Wrap it in a structure for sanity-checked access.
     37   */
     38 #define POL_STATS_SIZE	2		/* TLS level and REQUIRETLS */
     39 
     40 typedef struct POL_STATS {
     41     int     used;
     42     POL_STAT st[POL_STATS_SIZE];
     43 } POL_STATS;
     44 
     45 #ifdef USE_TLS
     46 
     47 extern POL_STATS *pol_stats_create(void);
     48 extern void pol_stats_revert(POL_STATS *);
     49 extern void pol_stats_free(POL_STATS *);
     50 
     51 #define pol_stats_used(t) ((t)->used)
     52 extern void pol_stat_activate(POL_STATS *, int, const char *);
     53 extern void pol_stat_decide(POL_STATS *, int, const char *, int);
     54 extern void pol_stats_format(VSTRING *, const POL_STATS *);
     55 
     56 #endif					/* USE_TLS */
     57 
     58 #define NO_TLS_STATS	((POL_STATS *) 0)
     59 
     60 /* LICENSE
     61 /* .ad
     62 /* .fi
     63 /*	The Secure Mailer license must be distributed with this software.
     64 /* AUTHOR(S)
     65 /*	Wietse Venema
     66 /*	porcupine.org
     67 /*--*/
     68 
     69 #endif					/* _POL_STATS_H_INCLUDED_ */
     70