/*++ /* NAME /* name_mask 3 /* SUMMARY /* map names to bit mask /* SYNOPSIS /* #include <name_mask.h> /* /* int name_mask(context, table, names) /* const char *context; /* const NAME_MASK *table; /* const char *names; /* /* long long_name_mask(context, table, names) /* const char *context; /* const LONG_NAME_MASK *table; /* const char *names; /* /* const char *str_name_mask(context, table, mask) /* const char *context; /* const NAME_MASK *table; /* int mask; /* /* const char *str_long_name_mask(context, table, mask) /* const char *context; /* const LONG_NAME_MASK *table; /* long mask; /* /* int name_mask_opt(context, table, names, flags) /* const char *context; /* const NAME_MASK *table; /* const char *names; /* int flags; /* /* long long_name_mask_opt(context, table, names, flags) /* const char *context; /* const LONG_NAME_MASK *table; /* const char *names; /* int flags; /* /* int name_mask_delim_opt(context, table, names, delim, flags) /* const char *context; /* const NAME_MASK *table; /* const char *names; /* const char *delim; /* int flags; /* /* long long_name_mask_delim_opt(context, table, names, delim, flags) /* const char *context; /* const LONG_NAME_MASK *table; /* const char *names; /* const char *delim; /* int flags; /* /* const char *str_name_mask_opt(buf, context, table, mask, flags) /* VSTRING *buf; /* const char *context; /* const NAME_MASK *table; /* int mask; /* int flags; /* /* const char *str_name_mask_delim_opt( /* VSTRING *buf, /* const char *context, /* const NAME_MASK *table, /* int mask, /* const char *delim, /* int flags) /* /* const char *str_long_name_mask_opt(buf, context, table, mask, flags) /* VSTRING *buf; /* const char *context; /* const LONG_NAME_MASK *table; /* long mask; /* int flags; /* DESCRIPTION /* name_mask() takes a null-terminated \fItable\fR with (name, mask) /* values and computes the bit-wise OR of the masks that correspond /* to the names listed in the \fInames\fR argument, separated by /* comma and/or whitespace characters. The "long_" version returns /* a "long int" bitmask, rather than an "int" bitmask. /* /* str_name_mask() translates a mask into its equivalent names. /* The result is written to a static buffer that is overwritten /* upon each call. The "long_" version converts a "long int" /* bitmask, rather than an "int" bitmask. /* /* name_mask_opt() and str_name_mask_opt() are extended versions /* with additional fine control. name_mask_delim_opt() supports /* non-default delimiter characters. /* /* Arguments: /* .IP buf /* Null pointer or pointer to buffer storage. /* .IP context /* What kind of names and /* masks are being manipulated, in order to make error messages /* more understandable. Typically, this would be the name of a /* user-configurable parameter. /* .IP table /* Table with (name, bit mask) pairs. /* .IP names /* A list of names that is to be converted into a bit mask. /* .IP mask /* A bit mask. /* .IP delim /* When converting from string to mask, the set of delimiter /* characters to use instead of whitespace and commas. When /* converting from mask to string, the delimiter string to use /* instead what may be specified with flags. /* .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: NAME_MASK_FATAL, NAME_MASK_RETURN, /* NAME_MASK_WARN or NAME_MASK_IGNORE. /* /* When converting from mask to string, at least one of the /* following must be specified: NAME_MASK_NUMBER, NAME_MASK_FATAL, /* NAME_MASK_RETURN, NAME_MASK_WARN or NAME_MASK_IGNORE. /* .RS /* .IP NAME_MASK_NUMBER /* When converting from string to mask, accept hexadecimal /* inputs starting with "0x" followed by hexadecimal digits. /* Each hexadecimal input may specify multiple bits. This /* feature is ignored for hexadecimal inputs that cannot be /* converted (malformed, out of range, etc.). /* /* When converting from mask to string, represent bits not /* defined in \fItable\fR as "0x" followed by hexadecimal /* digits. This conversion always succeeds. /* .IP NAME_MASK_FATAL /* Require that all names listed in \fIname\fR exist in /* \fItable\fR or that they can be parsed as a hexadecimal /* string, and require that all bits listed in \fImask\fR exist /* in \fItable\fR or that they can be converted to hexadecimal /* string. Terminate with a fatal run-time error if this /* condition is not met. This feature is enabled by default /* when calling name_mask() or str_name_mask(). /* .IP NAME_MASK_RETURN /* Require that all names listed in \fIname\fR exist in /* \fItable\fR or that they can be parsed as a hexadecimal /* string, and require that all bits listed in \fImask\fR exist /* in \fItable\fR or that they can be converted to hexadecimal /* string. Log a warning, and return 0 (name_mask()) or a /* null pointer (str_name_mask()) if this condition is not /* met. This feature is not enabled by default when calling /* name_mask() or str_name_mask(). /* .IP NAME_MASK_WARN /* Require that all names listed in \fIname\fR exist in /* \fItable\fR or that they can be parsed as a hexadecimal /* string, and require that all bits listed in \fImask\fR exist /* in \fItable\fR or that they can be converted to hexadecimal /* string. Log a warning if this condition is not met, continue /* processing, and return all valid bits or names. This feature /* is not enabled by default when calling name_mask() or /* str_name_mask(). /* .IP NAME_MASK_IGNORE /* Silently ignore names listed in \fIname\fR that don't exist /* in \fItable\fR and that can't be parsed as a hexadecimal /* string, and silently ignore bits listed in \fImask\fR that /* don't exist in \fItable\fR and that can't be converted to /* hexadecimal string. /* .IP NAME_MASK_ANY_CASE /* Enable case-insensitive matching. /* This feature is not enabled by default when calling name_mask(); /* it has no effect with str_name_mask(). /* .IP NAME_MASK_COMMA /* Use comma instead of space when converting a mask to string. /* .IP NAME_MASK_PIPE /* Use "|" instead of space when converting a mask to string. /* .RE /* The value NAME_MASK_NONE explicitly requests no features, /* and NAME_MASK_DEFAULT enables the default options. /* DIAGNOSTICS /* Fatal: the \fInames\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. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, 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.