]> arthur.barton.de Git - netatalk.git/blob - include/atalk/uuid.h
autogenerate UUIDs for TM volumes and store em in afp_voluuid.conf
[netatalk.git] / include / atalk / uuid.h
1 /*
2    $Id: uuid.h,v 1.1 2009-02-02 11:55:01 franklahm Exp $
3    Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9  
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14  */
15
16 #ifndef AFP_UUID_H
17 #define AFP_UUID_H
18
19 #define UUID_BINSIZE 16
20 #define UUID_STRINGSIZE 36
21
22 typedef char *uuidp_t;
23 typedef char atalk_uuid_t[UUID_BINSIZE];
24
25 typedef enum {UUID_USER = 1, UUID_GROUP} uuidtype_t;
26 extern char *uuidtype[];
27
28 /* afp_options.c needs these. defined in libatalk/ldap.c */
29 extern char *ldap_host;
30 extern int  ldap_auth_method;
31 extern char *ldap_auth_dn;
32 extern char *ldap_auth_pw;
33 extern char *ldap_userbase;
34 extern char *ldap_groupbase;
35 extern char *ldap_uuid_attr;
36 extern char *ldap_name_attr;
37 extern char *ldap_group_attr;
38 extern char *ldap_uid_attr;
39
40 /******************************************************** 
41  * Interface
42  ********************************************************/
43
44 /*
45  *   name: give me his name
46  *   type: and type (UUID_USER or UUID_GROUP)
47  *   uuid: and I'll try to return you his uuid
48  * returns 0 on success !=0 on errror
49  */  
50 extern int getuuidfromname( const char *name, uuidtype_t type, uuidp_t uuid);
51
52 /* 
53  *   uuidp: give me a pointer to a uuid
54  *   name: and I'll allocate a buf with his name and store a pointer to buf
55  *   type: returns USER or GROUP
56  * return 0 on success !=0 on errror
57  */
58 extern int getnamefromuuid( uuidp_t uuidp, char **name, uuidtype_t *type);
59
60 /* 
61  * convert 16 byte binary uuid to neat ascii represantation including dashes
62  * string is allocated and pointer returned. caller must freee.
63  */
64 extern int uuid_bin2string( uuidp_t uuidp, char **uuidstring);
65
66
67 /* 
68  * convert ascii string that can include dashes to binary uuid.
69  * caller must provide a buffer.
70  */
71 extern void uuid_string2bin( const char *uuidstring, uuidp_t uuid);
72
73 #endif /* AFP_UUID_H */