#include <pwd.h>
#define AUTH_DEFAULT -1
#define AUTH_NONE 0
#define AUTH_BASIC 1
#define AUTH_DIGEST 2
#define AUTH_BASICDIGEST 3
#define AUTH_NEGOTIATE 4
#define AUTH_ANON 0
#define AUTH_USER 1
#define AUTH_GROUP 2
#define AUTH_ALLOW 0
#define AUTH_DENY 1
#define AUTH_NAME 0
#define AUTH_IP 1
#define AUTH_INTERFACE 2
#define AUTH_SATISFY_ALL 0
#define AUTH_SATISFY_ANY 1
#define AUTH_LIMIT_DELETE 1
#define AUTH_LIMIT_GET 2
#define AUTH_LIMIT_HEAD 4
#define AUTH_LIMIT_OPTIONS 8
#define AUTH_LIMIT_POST 16
#define AUTH_LIMIT_PUT 32
#define AUTH_LIMIT_TRACE 64
#define AUTH_LIMIT_ALL 127
#define AUTH_LIMIT_IPP 128
#define IPP_ANY_OPERATION (ipp_op_t)0
#define IPP_BAD_OPERATION (ipp_op_t)-1
typedef struct
{
unsigned address[4],
netmask[4];
} cupsd_ipmask_t;
typedef struct
{
int length;
char *name;
} cupsd_namemask_t;
typedef struct
{
int type;
union
{
cupsd_namemask_t name;
cupsd_ipmask_t ip;
} mask;
} cupsd_authmask_t;
typedef struct
{
char *location;
ipp_op_t op;
int limit,
length,
order_type,
type,
level,
satisfy;
int num_names;
char **names;
int num_allow;
cupsd_authmask_t *allow;
int num_deny;
cupsd_authmask_t *deny;
http_encryption_t encryption;
} cupsd_location_t;
typedef struct cupsd_client_s cupsd_client_t;
VAR cups_array_t *Locations VALUE(NULL);
VAR int DefaultAuthType VALUE(AUTH_BASIC);
#ifdef HAVE_SSL
VAR http_encryption_t DefaultEncryption VALUE(HTTP_ENCRYPT_REQUIRED);
#endif
extern cupsd_location_t *cupsdAddLocation(const char *location);
extern void cupsdAddName(cupsd_location_t *loc, char *name);
extern void cupsdAllowHost(cupsd_location_t *loc, char *name);
extern void cupsdAllowIP(cupsd_location_t *loc, unsigned address[4],
unsigned netmask[4]);
extern void cupsdAuthorize(cupsd_client_t *con);
extern int cupsdCheckAuth(unsigned ip[4], char *name, int namelen,
int num_masks, cupsd_authmask_t *masks);
extern int cupsdCheckGroup(const char *username,
struct passwd *user,
const char *groupname);
extern cupsd_location_t *cupsdCopyLocation(cupsd_location_t **loc);
extern void cupsdDeleteAllLocations(void);
extern void cupsdDeleteLocation(cupsd_location_t *loc);
extern void cupsdDenyHost(cupsd_location_t *loc, char *name);
extern void cupsdDenyIP(cupsd_location_t *loc, unsigned address[4],
unsigned netmask[4]);
extern cupsd_location_t *cupsdFindBest(const char *path, http_state_t state);
extern cupsd_location_t *cupsdFindLocation(const char *location);
extern http_status_t cupsdIsAuthorized(cupsd_client_t *con, const char *owner);