]>
git.saurik.com Git - apple/libinfo.git/blob - netinfo.subproj/ni_util.h
6cb2c5659b83286c1a1ef280b443db9d301c0cef
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Utility routines for NetInfo
26 * Copyright (C) 1989 by NeXT, Inc.
32 #include <netinfo/ni.h>
34 #define NI_INDEX_NULL ((ni_index)-1)
35 #define NI_INIT(objp) bzero((void *)(objp), sizeof(*(objp)))
37 ni_name
ni_name_dup(ni_name_const
);
38 void ni_name_free(ni_name
*);
39 int ni_name_match(ni_name_const
, ni_name_const
);
41 ni_namelist
ni_namelist_dup(const ni_namelist
);
42 void ni_namelist_free(ni_namelist
*);
43 void ni_namelist_insert(ni_namelist
*, ni_name_const
, ni_index
);
44 void ni_namelist_delete(ni_namelist
*, ni_index
);
45 ni_index
ni_namelist_match(const ni_namelist
, ni_name_const
);
47 ni_property
ni_prop_dup(const ni_property
);
48 void ni_prop_free(ni_property
*);
50 void ni_proplist_insert(ni_proplist
*, const ni_property
, ni_index
);
51 void ni_proplist_delete(ni_proplist
*, ni_index
);
52 ni_index
ni_proplist_match(const ni_proplist
, ni_name_const
, ni_name_const
);
53 ni_proplist
ni_proplist_dup(const ni_proplist
);
54 void ni_proplist_free(ni_proplist
*);
56 void ni_proplist_list_free(ni_proplist_list
*);
58 void ni_idlist_insert(ni_idlist
*, ni_index
, ni_index
);
59 int ni_idlist_delete(ni_idlist
*, ni_index
);
60 ni_idlist
ni_idlist_dup(const ni_idlist
);
61 void ni_idlist_free(ni_idlist
*);
63 void ni_entrylist_insert(ni_entrylist
*, ni_entry
);
64 void ni_entrylist_delete(ni_entrylist
*, ni_index
);
65 void ni_entrylist_free(ni_entrylist
*);
67 int innetgr(const char *, const char *, const char *, const char *);
70 * Search for a directory for all subdirs with key=val, when val is
71 * a regular expression. Usage:
72 * status = ni_search(domain, directory, key, val, flags, &list);
73 * val and flags are passed to regcomp (see regex(3)).
75 ni_status
ni_search(void *, ni_id
*, ni_name
, ni_name
, int, ni_entrylist
*);
78 * Searches from local domain to root to find the first directory with a
79 * given pathname. Last argument is a timeout. Usage:
80 * status = ni_find(&domain, &dir, path, timeout);
82 ni_status
ni_find(void **, ni_id
*, ni_name
, unsigned int);
85 * Parses a NetInfo URL, and returns the domain and directory referenced
87 * status = ni_url(ustring, &domain, &dir);
89 * BNF for NetInfo URLs:
90 * url ::= "netinfo://" <hostspec> [/[<domainspec>][:[<dirspec>]]]
91 * hostspec ::= [[[user][:[password]]]@]hostref
92 * hostref ::= <inet_addr> | <hostname>
93 * domainspec ::= <abs_domain> | <rel_domain>
94 * dirspec ::= <path> | <unsigned_integer>
96 ni_status
ni_url(char *, void **, ni_id
*);