]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/afp_util.c
First working IPC reconnect
[netatalk.git] / etc / afpd / afp_util.c
1 /*
2  * $Id: afp_util.c,v 1.10 2010-01-23 14:44:42 franklahm Exp $
3  *
4  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
5  * Copyright (c) 1990,1993 Regents of The University of Michigan.
6  * All Rights Reserved.  See COPYRIGHT.
7  *
8  * Copyright (c) 2002 netatalk
9  *
10  * 
11  */
12
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif /* HAVE_CONFIG_H */
16
17 #include <atalk/afp.h>
18 #include <atalk/globals.h>
19
20 const char *AfpNum2name(int num)
21 {
22         switch(num) {
23     case AFP_BYTELOCK      : return "AFP_BYTELOCK";         /*   1 */
24         case AFP_CLOSEVOL      : return "AFP_CLOSEVOL";             /*   2 */
25         case AFP_CLOSEDIR      : return "AFP_CLOSEDIR";             /*   3 */
26         case AFP_CLOSEFORK     : return "AFP_CLOSEFORK";            /*   4 */
27         case AFP_COPYFILE      : return "AFP_COPYFILE";             /*   5 */
28         case AFP_CREATEDIR     : return "AFP_CREATEDIR";            /*   6 */
29         case AFP_CREATEFILE    : return "AFP_CREATEFILE";           /*   7 */
30         case AFP_DELETE        : return "AFP_DELETE";               /*   8 */
31         case AFP_ENUMERATE     : return "AFP_ENUMERATE";            /*   9 */
32         case AFP_FLUSH         : return "AFP_FLUSH";                /*  10 */
33         case AFP_FLUSHFORK     : return "AFP_FLUSHFORK";            /*  11 */
34
35         case AFP_GETFORKPARAM  : return "AFP_GETFORKPARAM";     /*      14 */
36         case AFP_GETSRVINFO    : return "AFP_GETSRVINFO";           /*  15 */
37         case AFP_GETSRVPARAM   : return "AFP_GETSRVPARAM";      /*      16 */
38         case AFP_GETVOLPARAM   : return "AFP_GETVOLPARAM";      /*      17 */
39         case AFP_LOGIN         : return "AFP_LOGIN";                /*  18 */
40     case AFP_LOGINCONT     : return "AFP_LOGINCONT";        /*  19 */
41         case AFP_LOGOUT        : return "AFP_LOGOUT";               /*  20 */
42     case AFP_MAPID         : return "AFP_MAPID";            /*  21 */
43     case AFP_MAPNAME       : return "AFP_MAPNAME";          /*  22 */
44     case AFP_MOVE          : return "AFP_MOVE";             /*  23 */
45         case AFP_OPENVOL       : return "AFP_OPENVOL";              /*  24 */
46         case AFP_OPENDIR       : return "AFP_OPENDIR";              /*  25 */
47         case AFP_OPENFORK      : return "AFP_OPENFORK";             /*  26 */
48         case AFP_READ              : return "AFP_READ";                     /*  27 */
49     case AFP_RENAME        : return "AFP_RENAME";           /*  28 */
50     case AFP_SETDIRPARAM   : return "AFP_SETDIRPARAM";      /*  29 */
51     case AFP_SETFILEPARAM  : return "AFP_SETFILEPARAM";     /*  30 */
52     case AFP_SETFORKPARAM  : return "AFP_SETFORKPARAM";     /*  31 */
53     case AFP_SETVOLPARAM   : return "AFP_SETVOLPARAM ";     /*  32 */
54         case AFP_WRITE             : return "AFP_WRITE";                    /*  33 */
55         case AFP_GETFLDRPARAM  : return "AFP_GETFLDRPARAM";         /*  34 */   
56         case AFP_SETFLDRPARAM  : return "AFP_SETFLDRPARAM";         /*  35 */   
57         case AFP_CHANGEPW      : return "AFP_CHANGEPW";         /*  36 */       
58     case AFP_GETUSERINFO   : return "AFP_GETUSERINFO";      /*  37 */
59     case AFP_GETSRVRMSG    : return "AFP_GETSRVRMSG";       /*  38 */
60     case AFP_CREATEID      : return "AFP_CREATEID";         /*  39 */
61     case AFP_DELETEID      : return "AFP_DELETEID";         /*  40 */
62     case AFP_RESOLVEID     : return "AFP_RESOLVEID";        /*  41 */
63     case AFP_EXCHANGEFILE  : return "AFP_EXCHANGEFILE";     /*  42 */
64     case AFP_CATSEARCH     : return "AFP_CATSEARCH";        /*  43 */
65
66         case AFP_OPENDT        : return "AFP_OPENDT";                   /*  48 */
67         case AFP_CLOSEDT       : return "AFP_CLOSEDT";              /*  49 */
68     case AFP_GETICON       : return "AFP_GETICON";                  /*  51 */
69     case AFP_GTICNINFO     : return "AFP_GTICNINFO";            /*      52 */
70     case AFP_ADDAPPL       : return "AFP_ADDAPPL";              /*      53 */
71     case AFP_RMVAPPL       : return "AFP_RMVAPPL";              /*      54 */
72     case AFP_GETAPPL       : return "AFP_GETAPPL";              /*      55 */
73     case AFP_ADDCMT        : return "AFP_ADDCMT";               /*      56 */
74         case AFP_RMVCMT        : return "AFP_RMVCMT";           /*      57 */
75         case AFP_GETCMT        : return "AFP_GETCMT";           /*      58 */
76         case AFP_ADDICON       : return "AFP_ADDICON";          /* 192 */
77     /* version 3.0 */
78     case AFP_BYTELOCK_EXT  : return "AFP_BYTELOCK_EXT";     /*  59 */
79     case AFP_READ_EXT      : return "AFP_READ_EXT";         /*  60 */
80     case AFP_WRITE_EXT     : return "AFP_WRITE_EXT";        /*  61 */
81     case AFP_GETSESSTOKEN  : return "AFP_GETSESSTOKEN";     /*  64 */ 
82     case AFP_LOGIN_EXT     : return "AFP_LOGIN_EXT";        /*  63 */
83     case AFP_DISCTOLDSESS  : return "AFP_DISCTOLDSESS";     /*  65 */
84     case AFP_ENUMERATE_EXT : return "AFP_ENUMERATE_EXT";    /*  66 */
85     case AFP_CATSEARCH_EXT : return "AFP_CATSEARCH_EXT";    /*  67 */
86     /* version 3.1 */
87     case AFP_ENUMERATE_EXT2: return "AFP_ENUMERATE_EXT2";   /*  68 */
88     case AFP_ZZZ  : return "AFP_ZZZ";       /* 122 */
89     /* version 3.2 */                                                                                                                     
90     case AFP_GETEXTATTR         : return "AFP_GETEXTATTR";            /* 69 */
91     case AFP_SETEXTATTR         : return "AFP_SETEXTATTR";            /* 70 */
92     case AFP_REMOVEATTR         : return "AFP_REMOVEATTR";            /* 71 */
93     case AFP_LISTEXTATTR        : return "AFP_LISTEXTATTR";           /* 72 */
94     case AFP_GETACL             : return "AFP_GETACL";            /* 73 */
95     case AFP_SETACL             : return "AFP_SETACL";            /* 74 */
96     case AFP_ACCESS             : return "AFP_ACCESS";            /* 75 */
97     case AFP_SPOTLIGHT_PRIVATE  : return "AFP_SPOTLIGHT_PRIVATE"; /* 76 */
98     case AFP_SYNCDIR            : return "AFP_SYNCDIR";           /* 78 */
99     case AFP_SYNCFORK           : return "AFP_SYNCFORK";              /* 79 */
100         }
101         return "not yet defined";                                                                 
102 }
103
104 #define AFPERR2NAME(err) case err : return #err
105
106 const char *AfpErr2name(int err)
107 {
108     switch (err) {
109         AFPERR2NAME(AFP_OK);
110         AFPERR2NAME(AFPERR_DID1);
111         AFPERR2NAME(AFPERR_ACCESS);
112         AFPERR2NAME(AFPERR_AUTHCONT);
113         AFPERR2NAME(AFPERR_BADUAM);
114         AFPERR2NAME(AFPERR_BADVERS);
115         AFPERR2NAME(AFPERR_BITMAP);
116         AFPERR2NAME(AFPERR_CANTMOVE);
117         AFPERR2NAME(AFPERR_DENYCONF);
118         AFPERR2NAME(AFPERR_DIRNEMPT);
119         AFPERR2NAME(AFPERR_DFULL);
120         AFPERR2NAME(AFPERR_EOF);
121         AFPERR2NAME(AFPERR_BUSY);
122         AFPERR2NAME(AFPERR_FLATVOL);
123         AFPERR2NAME(AFPERR_NOITEM);
124         AFPERR2NAME(AFPERR_LOCK);
125         AFPERR2NAME(AFPERR_MISC);
126         AFPERR2NAME(AFPERR_NLOCK);
127         AFPERR2NAME(AFPERR_NOSRVR);
128         AFPERR2NAME(AFPERR_EXIST);
129         AFPERR2NAME(AFPERR_NOOBJ);
130         AFPERR2NAME(AFPERR_PARAM);
131         AFPERR2NAME(AFPERR_NORANGE);
132         AFPERR2NAME(AFPERR_RANGEOVR);
133         AFPERR2NAME(AFPERR_SESSCLOS);
134         AFPERR2NAME(AFPERR_NOTAUTH);
135         AFPERR2NAME(AFPERR_NOOP);
136         AFPERR2NAME(AFPERR_BADTYPE);
137         AFPERR2NAME(AFPERR_NFILE);
138         AFPERR2NAME(AFPERR_SHUTDOWN);
139         AFPERR2NAME(AFPERR_NORENAME);
140         AFPERR2NAME(AFPERR_NODIR);
141         AFPERR2NAME(AFPERR_ITYPE);
142         AFPERR2NAME(AFPERR_VLOCK);
143         AFPERR2NAME(AFPERR_OLOCK);
144         AFPERR2NAME(AFPERR_CTNSHRD);
145         AFPERR2NAME(AFPERR_NOID);
146         AFPERR2NAME(AFPERR_EXISTID);
147         AFPERR2NAME(AFPERR_DIFFVOL);
148         AFPERR2NAME(AFPERR_CATCHNG);
149         AFPERR2NAME(AFPERR_SAMEOBJ);
150         AFPERR2NAME(AFPERR_BADID);
151         AFPERR2NAME(AFPERR_PWDSAME);
152         AFPERR2NAME(AFPERR_PWDSHORT);
153         AFPERR2NAME(AFPERR_PWDEXPR);
154         AFPERR2NAME(AFPERR_INSHRD);
155         AFPERR2NAME(AFPERR_INTRASH);
156         AFPERR2NAME(AFPERR_PWDCHNG);
157         AFPERR2NAME(AFPERR_PWDPOLCY);
158         AFPERR2NAME(AFPERR_USRLOGIN);
159     }
160         return "not yet defined";
161 }