File: privtab.h

package info (click to toggle)
pennmush 1.8.0p4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,068 kB
  • ctags: 6,319
  • sloc: ansic: 68,221; sh: 7,056; perl: 1,150; makefile: 284
file content (35 lines) | stat: -rw-r--r-- 1,138 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* privtab.h */
/* Defines a privilege table entry for general use */

#ifndef __PRIVTAB_H
#define __PRIVTAB_H

#include "copyrite.h"
#include "config.h"
#include "confmagic.h"


typedef struct priv_info PRIV;
/** Privileges.
 * This structure represents a privilege and its associated data.
 * Privileges tables are used to provide a unified way to parse
 * a string of restrictions into a bitmask.
 */
struct priv_info {
  const char *name;	/**< Name of the privilege */
  char letter;		/**< One-letter abbreviation */
  long int bits_to_set;	/**< Bitflags required to set this privilege */
  long int bits_to_show;	/**< Bitflags required to see this privilege */
};

#define PrivName(x)     ((x)->name)
#define PrivChar(x)     ((x)->letter)
#define PrivSetBits(x)  ((x)->bits_to_set)
#define PrivShowBits(x) ((x)->bits_to_show)

extern int string_to_privs(PRIV *table, const char *str, long int origprivs);
extern int letter_to_privs(PRIV *table, const char *str, long int origprivs);
extern const char *privs_to_string(PRIV *table, int privs);
extern const char *privs_to_letters(PRIV *table, int privs);

#endif				/* __PRIVTAB_H */