]> git.saurik.com Git - apple/libinfo.git/blame - netinfo.subproj/ni_util.h
Libinfo-222.4.9.tar.gz
[apple/libinfo.git] / netinfo.subproj / ni_util.h
CommitLineData
03fb6eb0
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
ad21edcc
A
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
12 * this file.
03fb6eb0
A
13 *
14 * The Original Code and all software distributed under the License are
ad21edcc 15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
03fb6eb0
A
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
ad21edcc
A
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License.
03fb6eb0
A
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24/*
25 * Utility routines for NetInfo
26 * Copyright (C) 1989 by NeXT, Inc.
27 */
28
29#ifndef _NI_UTIL_H_
30#define _NI_UTIL_H_
31
32#include <netinfo/ni.h>
33
ccd4a120
A
34#ifdef __cplusplus
35extern "C" {
36#endif
37
03fb6eb0
A
38#define NI_INDEX_NULL ((ni_index)-1)
39#define NI_INIT(objp) bzero((void *)(objp), sizeof(*(objp)))
40
41ni_name ni_name_dup(ni_name_const);
42void ni_name_free(ni_name *);
43int ni_name_match(ni_name_const, ni_name_const);
44
45ni_namelist ni_namelist_dup(const ni_namelist);
46void ni_namelist_free(ni_namelist *);
47void ni_namelist_insert(ni_namelist *, ni_name_const, ni_index);
48void ni_namelist_delete(ni_namelist *, ni_index);
49ni_index ni_namelist_match(const ni_namelist, ni_name_const);
50
51ni_property ni_prop_dup(const ni_property);
52void ni_prop_free(ni_property *);
53
54void ni_proplist_insert(ni_proplist *, const ni_property, ni_index);
55void ni_proplist_delete(ni_proplist *, ni_index);
56ni_index ni_proplist_match(const ni_proplist, ni_name_const, ni_name_const);
57ni_proplist ni_proplist_dup(const ni_proplist);
58void ni_proplist_free(ni_proplist *);
59
60void ni_proplist_list_free(ni_proplist_list *);
61
62void ni_idlist_insert(ni_idlist *, ni_index, ni_index);
63int ni_idlist_delete(ni_idlist *, ni_index);
64ni_idlist ni_idlist_dup(const ni_idlist);
65void ni_idlist_free(ni_idlist *);
66
67void ni_entrylist_insert(ni_entrylist *, ni_entry);
68void ni_entrylist_delete(ni_entrylist *, ni_index);
69void ni_entrylist_free(ni_entrylist *);
70
71int innetgr(const char *, const char *, const char *, const char *);
72
73/*
74 * Search for a directory for all subdirs with key=val, when val is
75 * a regular expression. Usage:
76 * status = ni_search(domain, directory, key, val, flags, &list);
77 * val and flags are passed to regcomp (see regex(3)).
78 */
79ni_status ni_search(void *, ni_id *, ni_name, ni_name, int, ni_entrylist *);
80
81/*
82 * Searches from local domain to root to find the first directory with a
83 * given pathname. Last argument is a timeout. Usage:
84 * status = ni_find(&domain, &dir, path, timeout);
85 */
86ni_status ni_find(void **, ni_id *, ni_name, unsigned int);
87
88/*
89 * Parses a NetInfo URL, and returns the domain and directory referenced
90 * by the URL. Usage:
91 * status = ni_url(ustring, &domain, &dir);
92 *
93 * BNF for NetInfo URLs:
94 * url ::= "netinfo://" <hostspec> [/[<domainspec>][:[<dirspec>]]]
95 * hostspec ::= [[[user][:[password]]]@]hostref
96 * hostref ::= <inet_addr> | <hostname>
97 * domainspec ::= <abs_domain> | <rel_domain>
98 * dirspec ::= <path> | <unsigned_integer>
99 */
100ni_status ni_url(char *, void **, ni_id *);
101
ccd4a120
A
102#ifdef __cplusplus
103}
104#endif
105
106#endif !_NI_UTIL_H_
107