/*++ /* NAME /* byte_mask 3 /* SUMMARY /* map byte sequence to bit mask /* SYNOPSIS /* #include <byte_mask.h> /* /* typedef struct { /* .in +4 /* int byte_val; /* int mask; /* .in -4 /* } BYTE_MASK; /* /* int byte_mask( /* const char *context, /* const BYTE_MASK *table, /* const char *bytes); /* /* const char *str_byte_mask( /* const char *context, /* const BYTE_MASK *table, /* int mask); /* /* int byte_mask_opt( /* const char *context; /* const BYTE_MASK *table, /* const char *bytes, /* int flags); /* /* const char *str_byte_mask_opt( /* VSTRING *buf, /* const char *context, /* const BYTE_MASK *table, /* int mask, /* int flags); /* DESCRIPTION /* byte_mask() takes a null-terminated \fItable\fR with (byte /* value, single-bit mask) pairs and computes the bit-wise OR /* of the masks that correspond to the byte values pointed to /* by the \fIbytes\fR argument. /* /* str_byte_mask() translates a bit mask into its equivalent /* bytes. The result is written to a static buffer that is /* overwritten upon each call. /* /* byte_mask_opt() and str_byte_mask_opt() are extended versions /* with additional fine control. /* /* Arguments: /* .IP buf /* Null pointer or pointer to buffer storage. /* .IP context /* What kind of byte values and bit masks are being manipulated, /* reported in error messages. Typically, this would be the /* name of a user-configurable parameter or command-line /* attribute. /* .IP table /* Table with (byte value, single-bit mask) pairs. /* .IP bytes /* A null-terminated string that is to be converted into a bit /* mask. /* .IP mask /* A bit mask that is to be converted into null-terminated /* string. /* .IP flags /* Bit-wise OR of one or more of the following. Where features /* would have conflicting results (e.g., FATAL versus IGNORE), /* the feature that takes precedence is described first. /* /* When converting from string to mask, at least one of the /* following must be specified: BYTE_MASK_FATAL, BYTE_MASK_RETURN, /* BYTE_MASK_WARN or BYTE_MASK_IGNORE. /* /* When converting from mask to string, at least one of the /* following must be specified: BYTE_MASK_FATAL, BYTE_MASK_RETURN, /* BYTE_MASK_WARN or BYTE_MASK_IGNORE. /* .RS /* .IP BYTE_MASK_FATAL /* Require that all values in \fIbytes\fR exist in \fItable\fR, /* and require that all bits listed in \fImask\fR exist in /* \fItable\fR. Terminate with a fatal run-time error if this /* condition is not met. This feature is enabled by default /* when calling byte_mask() or str_name_mask(). /* .IP BYTE_MASK_RETURN /* Require that all values in \fIbytes\fR exist in \fItable\fR, /* and require that all bits listed in \fImask\fR exist in /* \fItable\fR. Log a warning, and return 0 (byte_mask()) or /* a null pointer (str_byte_mask()) if this condition is not /* met. This feature is not enabled by default when calling /* byte_mask() or str_name_mask(). /* .IP BYTE_MASK_WARN /* Require that all values in \fIbytes\fR exist in \fItable\fR, /* and require that all bits listed in \fImask\fR exist in /* \fItable\fR. Log a warning if this condition is not met, /* continue processing, and return all valid bits or bytes. /* This feature is not enabled by default when calling byte_mask() /* or str_byte_mask(). /* .IP BYTE_MASK_IGNORE /* Silently ignore values in \fIbytes\fR that don't exist in /* \fItable\fR, and silently ignore bits listed in \fImask\fR /* that don't exist in \fItable\fR. This feature is not enabled /* by default when calling byte_mask() or str_byte_mask(). /* .IP BYTE_MASK_ANY_CASE /* Enable case-insensitive matching. This feature is not /* enabled by default when calling byte_mask(); it has no /* effect with str_byte_mask(). /* .RE /* The value BYTE_MASK_NONE explicitly requests no features, /* and BYTE_MASK_DEFAULT enables the default options. /* DIAGNOSTICS /* Fatal: the \fIbytes\fR argument specifies a name not found in /* \fItable\fR, or the \fImask\fR specifies a bit not found in /* \fItable\fR. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* HISTORY /* This code is a clone of Postfix name_mask(3). /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.