"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/irs.h" (6 Nov 2009, 11331 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Copyright (c) 1996,1999 by Internet Software Consortium.
    3  *
    4  * Permission to use, copy, modify, and distribute this software for any
    5  * purpose with or without fee is hereby granted, provided that the above
    6  * copyright notice and this permission notice appear in all copies.
    7  *
    8  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
    9  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
   10  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
   11  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
   12  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
   13  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
   14  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   15  * SOFTWARE.
   16  */
   17 
   18 /*
   19  * $Id: irs.h,v 2.3 2004/09/10 11:49:09 lukeh Exp $
   20  */
   21 
   22 #ifndef _IRS_H_INCLUDED
   23 #define _IRS_H_INCLUDED
   24 
   25 #include <sys/types.h>
   26 
   27 #include <sys/types.h>
   28 #include <netinet/in.h> 
   29 #include <arpa/nameser.h>
   30 
   31 #include <grp.h>
   32 #include <netdb.h>
   33 
   34 #include <resolv.h>
   35 #include <pwd.h>
   36 
   37 #ifndef __P
   38 # if defined(__STDC__) || defined(__GNUC__)
   39 #  define __P(x) x
   40 # else
   41 #  define __P(x) ()
   42 # endif
   43 #endif
   44 
   45 /*
   46  * This is the group map class.
   47  */
   48 struct irs_gr {
   49     void *      private;
   50     void        (*close) __P((struct irs_gr *));
   51     struct group *  (*next) __P((struct irs_gr *));
   52     struct group *  (*byname) __P((struct irs_gr *, const char *));
   53     struct group *  (*bygid) __P((struct irs_gr *, gid_t));
   54     int     (*list) __P((struct irs_gr *, const char *,
   55                      gid_t, gid_t *, int *));
   56     void        (*rewind) __P((struct irs_gr *));
   57     void        (*minimize) __P((struct irs_gr *));
   58     struct __res_state * (*res_get) __P((struct irs_gr *));
   59     void        (*res_set) __P((struct irs_gr *, struct __res_state *,
   60                     void (*)(void *)));
   61 };
   62 
   63 /*
   64  * This is the password map class.
   65  */
   66 struct irs_pw {
   67     void *      private;
   68     void        (*close) __P((struct irs_pw *));
   69     struct passwd * (*next) __P((struct irs_pw *));
   70     struct passwd * (*byname) __P((struct irs_pw *, const char *));
   71     struct passwd * (*byuid) __P((struct irs_pw *, uid_t));
   72     void        (*rewind) __P((struct irs_pw *));
   73     void        (*minimize) __P((struct irs_pw *));
   74     struct __res_state * (*res_get) __P((struct irs_pw *));
   75     void        (*res_set) __P((struct irs_pw *, struct __res_state *,
   76                     void (*)(void *)));
   77 };
   78 
   79 /*
   80  * This is the service map class.
   81  */
   82 struct irs_sv {
   83     void *      private;
   84     void        (*close) __P((struct irs_sv *));
   85     struct servent *(*byname) __P((struct irs_sv *,
   86                        const char *, const char *));
   87     struct servent *(*byport) __P((struct irs_sv *, int, const char *));
   88     struct servent *(*next) __P((struct irs_sv *));
   89     void        (*rewind) __P((struct irs_sv *));
   90     void        (*minimize) __P((struct irs_sv *));
   91     struct __res_state * (*res_get) __P((struct irs_sv *));
   92     void        (*res_set) __P((struct irs_sv *, struct __res_state *,
   93                     void (*)(void *)));
   94 };
   95 
   96 /*
   97  * This is the protocols map class.
   98  */
   99 struct irs_pr {
  100     void *      private;
  101     void        (*close) __P((struct irs_pr *));
  102     struct protoent *(*byname) __P((struct irs_pr *, const char *));
  103     struct protoent *(*bynumber) __P((struct irs_pr *, int));
  104     struct protoent *(*next) __P((struct irs_pr *));
  105     void        (*rewind) __P((struct irs_pr *));
  106     void        (*minimize) __P((struct irs_pr *));
  107     struct __res_state * (*res_get) __P((struct irs_pr *));
  108     void        (*res_set) __P((struct irs_pr *, struct __res_state *,
  109                     void (*)(void *)));
  110 };
  111 
  112 /*
  113  * This is the hosts map class.
  114  */
  115 struct irs_ho {
  116     void *      private;
  117     void        (*close) __P((struct irs_ho *));
  118     struct hostent *(*byname) __P((struct irs_ho *, const char *));
  119     struct hostent *(*byname2) __P((struct irs_ho *, const char *, int));
  120     struct hostent *(*byaddr) __P((struct irs_ho *,
  121                        const void *, int, int));
  122     struct hostent *(*next) __P((struct irs_ho *));
  123     void        (*rewind) __P((struct irs_ho *));
  124     void        (*minimize) __P((struct irs_ho *));
  125     struct __res_state * (*res_get) __P((struct irs_ho *));
  126     void        (*res_set) __P((struct irs_ho *, struct __res_state *,
  127                     void (*)(void *)));
  128 };
  129 
  130 /*
  131  * This is the networks map class.
  132  */
  133 struct irs_nw {
  134     void *      private;
  135     void        (*close) __P((struct irs_nw *));
  136     struct nwent *  (*byname) __P((struct irs_nw *, const char *, int));
  137     struct nwent *  (*byaddr) __P((struct irs_nw *, void *, int, int));
  138     struct nwent *  (*next) __P((struct irs_nw *));
  139     void        (*rewind) __P((struct irs_nw *));
  140     void        (*minimize) __P((struct irs_nw *));
  141     struct __res_state * (*res_get) __P((struct irs_nw *));
  142     void        (*res_set) __P((struct irs_nw *, struct __res_state *,
  143                     void (*)(void *)));
  144 };
  145 
  146 /*
  147  * This is the netgroups map class.
  148  */
  149 struct irs_ng {
  150     void *      private;
  151     void        (*close) __P((struct irs_ng *));
  152     int     (*next) __P((struct irs_ng *, char **, char **,
  153                      char **));
  154     int     (*test) __P((struct irs_ng *, const char *,
  155                      const char *, const char *,
  156                      const char *));
  157     void        (*rewind) __P((struct irs_ng *, const char *));
  158     void        (*minimize) __P((struct irs_ng *));
  159 };
  160 
  161 /*
  162  * This is the generic map class, which copies the front of all others.
  163  */
  164 struct irs_map {
  165     void *      private;
  166     void        (*close) __P((void *));
  167 };
  168 
  169 /*
  170  * This is the accessor class.  It contains pointers to all of the
  171  * initializers for the map classes for a particular accessor.
  172  */
  173 struct irs_acc {
  174     void *      private;
  175     void        (*close) __P((struct irs_acc *));
  176     struct irs_gr * (*gr_map) __P((struct irs_acc *));
  177     struct irs_pw * (*pw_map) __P((struct irs_acc *));
  178     struct irs_sv * (*sv_map) __P((struct irs_acc *));
  179     struct irs_pr * (*pr_map) __P((struct irs_acc *));
  180     struct irs_ho * (*ho_map) __P((struct irs_acc *));
  181     struct irs_nw * (*nw_map) __P((struct irs_acc *));
  182     struct irs_ng * (*ng_map) __P((struct irs_acc *));
  183     struct __res_state * (*res_get) __P((struct irs_acc *));
  184     void        (*res_set) __P((struct irs_acc *, struct __res_state *,
  185                     void (*)(void *)));
  186 };
  187 
  188 /*
  189  * This is because the official definition of "struct netent" has no
  190  * concept of CIDR even though it allows variant address families (on
  191  * output but not input).  The compatibility stubs convert the structs
  192  * below into "struct netent"'s.
  193  */
  194 struct nwent {
  195     char        *n_name;    /* official name of net */
  196     char        **n_aliases;    /* alias list */
  197     int     n_addrtype; /* net address type */
  198     void        *n_addr;    /* network address */
  199     int     n_length;   /* address length, in bits */
  200 };
  201 
  202 /*
  203  * Hide external function names from POSIX.
  204  */
  205 #define irs_gen_acc __irs_gen_acc
  206 #define irs_lcl_acc __irs_lcl_acc
  207 #define irs_dns_acc __irs_dns_acc
  208 #define irs_nis_acc __irs_nis_acc
  209 #define irs_irp_acc __irs_irp_acc
  210 
  211 /*
  212  * Externs.
  213  */
  214 extern struct irs_acc * irs_gen_acc __P((const char *options, 
  215                      const char *conf_file));
  216 extern struct irs_acc * irs_lcl_acc __P((const char *options));
  217 extern struct irs_acc * irs_dns_acc __P((const char *options));
  218 extern struct irs_acc * irs_nis_acc __P((const char *options));
  219 extern struct irs_acc * irs_irp_acc __P((const char *options));
  220 
  221 /*
  222  * These forward declarations are for the semi-private functions in
  223  * the get*.c files. Each of these funcs implements the real get*
  224  * functionality and the standard versions are just wrappers that
  225  * call these. Apart from the wrappers, only irpd is expected to
  226  * call these directly, hence these decls are put here and not in
  227  * the /usr/include replacements.
  228  */
  229 
  230 struct net_data;            /* forward */
  231 
  232 /*
  233  * net_data_create gets a singleton net_data object.  net_data_init
  234  * creates as many net_data objects as times it is called.  Clients using
  235  * the default interface will use net_data_create by default.  Servers will
  236  * probably want net_data_init (one call per client)
  237  */
  238 struct net_data *net_data_create(const char *conf_file);
  239 struct net_data *net_data_init(const char *conf_file);
  240 void        net_data_destroy(void *p);
  241     
  242 extern struct group    *getgrent_p __P((struct net_data *net_data));
  243 extern struct group    *getgrnam_p __P((const char *name,
  244                     struct net_data *net_data));
  245 extern struct group    *getgrgid_p __P((gid_t gid,
  246                     struct net_data *net_data));
  247 extern int      setgroupent_p __P((int stayopen,
  248                        struct net_data *net_data));
  249 extern void         endgrent_p __P((struct net_data *net_data));
  250 extern int      getgrouplist_p __P((const char *name,
  251                         gid_t basegid,
  252                         gid_t *groups,
  253                         int *ngroups,
  254                         struct net_data *net_data));
  255 
  256 #ifdef SETGRENT_VOID
  257 extern void         setgrent_p __P((struct net_data *net_data));
  258 #else
  259 extern int      setgrent_p __P((struct net_data *net_data));
  260 #endif
  261 
  262 extern struct hostent   *gethostbyname_p __P((const char *name,
  263                           struct net_data *net_data));
  264 extern struct hostent   *gethostbyname2_p __P((const char *name, int af,
  265                            struct net_data *net_data));
  266 extern struct hostent   *gethostbyaddr_p __P((const char *addr, int len,
  267                           int af,
  268                           struct net_data *net_data));
  269 extern struct hostent   *gethostent_p __P((struct net_data *net_data));
  270 extern void         sethostent_p __P((int stayopen,
  271                       struct net_data *net_data));
  272 extern void         endhostent_p __P((struct net_data *net_data));
  273 
  274 extern struct netent    *getnetent_p __P((struct net_data *net_data));
  275 extern struct netent    *getnetbyname_p __P((const char *name,
  276                          struct net_data *net_data));
  277 extern struct netent    *getnetbyaddr_p __P((unsigned long net, int type,
  278                          struct net_data *net_data));
  279 extern void     setnetent_p __P((int stayopen,
  280                      struct net_data *net_data));
  281 extern void     endnetent_p __P((struct net_data *net_data));
  282 
  283 extern void     setnetgrent_p __P((const char *netgroup,
  284                        struct net_data *net_data));
  285 extern void     endnetgrent_p __P((struct net_data *net_data));
  286 extern int      innetgr_p __P((const char *netgroup,
  287                        const char *host,
  288                        const char *user,
  289                        const char *domain,
  290                        struct net_data *net_data));
  291 extern int      getnetgrent_p __P((char **host, char **user,
  292                        char **domain,
  293                        struct net_data *net_data));
  294 
  295 extern struct protoent  *getprotoent_p __P((struct net_data *net_data));
  296 extern struct protoent  *getprotobyname_p __P((const char *name,
  297                            struct net_data *net_data));
  298 extern struct protoent  *getprotobynumber_p __P((int proto,
  299                          struct net_data *net_data));
  300 extern void     setprotoent_p __P((int stayopen,
  301                        struct net_data *net_data));
  302 extern void     endprotoent_p __P((struct net_data *net_data));
  303 
  304 
  305 extern struct passwd    *getpwent_p __P((struct net_data *net_data));
  306 extern struct passwd    *getpwnam_p __P((const char *name,
  307                      struct net_data *net_data));
  308 extern struct passwd    *getpwuid_p __P((uid_t uid,
  309                      struct net_data *net_data));
  310 extern int      setpassent_p __P((int stayopen,
  311                       struct net_data *net_data));
  312 extern void     endpwent_p __P((struct net_data *net_data));
  313 
  314 #ifdef SETPWENT_VOID
  315 extern void     setpwent_p __P((struct net_data *net_data));
  316 #else
  317 extern int      setpwent_p __P((struct net_data *net_data));
  318 #endif
  319 
  320 extern struct servent   *getservent_p __P((struct net_data *net_data));
  321 extern struct servent   *getservbyname_p __P((const char *name,
  322                           const char *proto,
  323                           struct net_data *net_data));
  324 extern struct servent   *getservbyport_p __P((int port, const char *proto,
  325                           struct net_data *net_data));
  326 extern void     setservent_p __P((int stayopen,
  327                       struct net_data *net_data));
  328 extern void     endservent_p __P((struct net_data *net_data));
  329 
  330 #endif /*_IRS_H_INCLUDED*/