| 1 |
/* ----------------------------------------------------------------------- * |
| 2 |
* |
| 3 |
* parse_subs.c - misc parser subroutines |
| 4 |
* automounter map |
| 5 |
* |
| 6 |
* Copyright 1997 Transmeta Corporation - All Rights Reserved |
| 7 |
* Copyright 2000 Jeremy Fitzhardinge <[email protected]> |
| 8 |
* Copyright 2004-2006 Ian Kent <[email protected]> |
| 9 |
* |
| 10 |
* This program is free software; you can redistribute it and/or modify |
| 11 |
* it under the terms of the GNU General Public License as published by |
| 12 |
* the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, |
| 13 |
* USA; either version 2 of the License, or (at your option) any later |
| 14 |
* version; incorporated herein by reference. |
| 15 |
* |
| 16 |
* ----------------------------------------------------------------------- */ |
| 17 |
|
| 18 |
#ifndef PARSE_SUBS_H |
| 19 |
#define PARSE_SUBS_H |
| 20 |
|
| 21 |
#define PROXIMITY_ERROR 0x0000 |
| 22 |
#define PROXIMITY_LOCAL 0x0001 |
| 23 |
#define PROXIMITY_SUBNET 0x0002 |
| 24 |
#define PROXIMITY_NET 0x0004 |
| 25 |
#define PROXIMITY_OTHER 0x0008 |
| 26 |
#define PROXIMITY_UNSUPPORTED 0x0010 |
| 27 |
|
| 28 |
#define SEL_ARCH 0x00000001 |
| 29 |
#define SEL_KARCH 0x00000002 |
| 30 |
#define SEL_OS 0x00000004 |
| 31 |
#define SEL_OSVER 0x00000008 |
| 32 |
#define SEL_FULL_OS 0x00000010 |
| 33 |
#define SEL_VENDOR 0x00000020 |
| 34 |
#define SEL_HOST 0x00000040 |
| 35 |
#define SEL_HOSTD 0x00000080 |
| 36 |
#define SEL_XHOST 0x00000100 |
| 37 |
#define SEL_DOMAIN 0x00000200 |
| 38 |
#define SEL_BYTE 0x00000400 |
| 39 |
#define SEL_CLUSTER 0x00000800 |
| 40 |
#define SEL_NETGRP 0x00001000 |
| 41 |
#define SEL_NETGRPD 0x00002000 |
| 42 |
#define SEL_IN_NETWORK 0x00004000 |
| 43 |
#define SEL_UID 0x00008000 |
| 44 |
#define SEL_GID 0x00010000 |
| 45 |
#define SEL_KEY 0x00020000 |
| 46 |
#define SEL_MAP 0x00040000 |
| 47 |
#define SEL_PATH 0x00080000 |
| 48 |
#define SEL_EXISTS 0x00100000 |
| 49 |
#define SEL_AUTODIR 0x00200000 |
| 50 |
#define SEL_DOLLAR 0x00400000 |
| 51 |
#define SEL_TRUE 0x00800000 |
| 52 |
#define SEL_FALSE 0x01000000 |
| 53 |
|
| 54 |
#define SEL_COMP_NONE 0x0000 |
| 55 |
#define SEL_COMP_EQUAL 0x0001 |
| 56 |
#define SEL_COMP_NOTEQUAL 0x0002 |
| 57 |
#define SEL_COMP_NOT 0x0004 |
| 58 |
|
| 59 |
#define SEL_FLAG_MACRO 0x0001 |
| 60 |
#define SEL_FLAG_FUNC1 0x0002 |
| 61 |
#define SEL_FLAG_FUNC2 0x0004 |
| 62 |
#define SEL_FLAG_STR 0x0100 |
| 63 |
#define SEL_FLAG_NUM 0x0200 |
| 64 |
#define SEL_FLAG_BOOL 0x0400 |
| 65 |
|
| 66 |
#define SEL_FLAGS_TYPE_MASK 0x00FF |
| 67 |
#define SEL_FLAGS_VALUE_MASK 0xFF00 |
| 68 |
#define SEL_FREE_VALUE_MASK (SEL_FLAG_MACRO|SEL_FLAG_STR|SEL_FLAG_NUM) |
| 69 |
#define SEL_FREE_ARG1_MASK (SEL_FLAG_FUNC1) |
| 70 |
#define SEL_FREE_ARG2_MASK (SEL_FLAG_FUNC2) |
| 71 |
|
| 72 |
struct type_compare { |
| 73 |
char *value; |
| 74 |
}; |
| 75 |
|
| 76 |
struct type_function { |
| 77 |
char *arg1; |
| 78 |
char *arg2; |
| 79 |
}; |
| 80 |
|
| 81 |
struct sel { |
| 82 |
unsigned long selector; |
| 83 |
const char *name; |
| 84 |
unsigned int flags; |
| 85 |
struct sel *next; |
| 86 |
}; |
| 87 |
|
| 88 |
struct selector { |
| 89 |
struct sel *sel; |
| 90 |
unsigned int compare; |
| 91 |
|
| 92 |
union { |
| 93 |
struct type_compare comp; |
| 94 |
struct type_function func; |
| 95 |
}; |
| 96 |
|
| 97 |
struct selector *next; |
| 98 |
}; |
| 99 |
|
| 100 |
void sel_hash_init(void); |
| 101 |
struct sel *sel_lookup(const char *); |
| 102 |
struct selector *get_selector(char *); |
| 103 |
void free_selector(struct selector *); |
| 104 |
|
| 105 |
struct mapent; |
| 106 |
|
| 107 |
struct map_type_info { |
| 108 |
char *type; |
| 109 |
char *format; |
| 110 |
char *map; |
| 111 |
}; |
| 112 |
|
| 113 |
unsigned int get_proximity(struct sockaddr *); |
| 114 |
unsigned int get_network_proximity(const char *); |
| 115 |
unsigned int in_network(char *); |
| 116 |
struct mapent *match_cached_key(struct autofs_point *, const char *, |
| 117 |
struct map_source *, const char *); |
| 118 |
const char *skipspace(const char *); |
| 119 |
int check_colon(const char *); |
| 120 |
int chunklen(const char *, int); |
| 121 |
int strmcmp(const char *, const char *, int); |
| 122 |
char *dequote(const char *, int, unsigned int); |
| 123 |
int span_space(const char *, unsigned int); |
| 124 |
char *sanitize_path(const char *, int, unsigned int, unsigned int); |
| 125 |
int starts_with_null_opt(const char *); |
| 126 |
char *merge_options(const char *, const char *); |
| 127 |
int expandamdent(const char *, char *, const struct substvar *); |
| 128 |
int expand_selectors(struct autofs_point *, const char *, char **, struct substvar *); |
| 129 |
int construct_argv(char *, char **, char ***); |
| 130 |
void free_map_type_info(struct map_type_info *); |
| 131 |
struct map_type_info *parse_map_type_info(const char *); |
| 132 |
|
| 133 |
#endif |