1 /* GIO - GLib Input, Output and Streaming Library 2 * 3 * Copyright (C) Carl-Anton Ingmarsson 2011 <ca.ingmarsson@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library 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 GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General 16 * Public License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 * Author: Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com> 21 */ 22 23 #ifndef _GVFSAFPUTILS_H_ 24 #define _GVFSAFPUTILS_H_ 25 26 #include <glib.h> 27 28 G_BEGIN_DECLS 29 30 typedef enum 31 { 32 AFP_RESULT_NO_ERROR = 0, 33 AFP_RESULT_NO_MORE_SESSIONS = -1068, 34 AFP_RESULT_ASP_SESS_CLOSED = -1072, 35 AFP_RESULT_ACCESS_DENIED = -5000, 36 AFP_RESULT_AUTH_CONTINUE = -5001, 37 AFP_RESULT_BAD_UAM = -5002, 38 AFP_RESULT_BAD_VERS_NUM = -5003, 39 AFP_RESULT_BITMAP_ERR = -5004, 40 AFP_RESULT_CANT_MOVE = -5005, 41 AFP_RESULT_DENY_CONFLICT = -5006, 42 AFP_RESULT_DIR_NOT_EMPTY = -5007, 43 AFP_RESULT_DISK_FULL = -5008, 44 AFP_RESULT_EOF_ERR = -5009, 45 AFP_RESULT_FILE_BUSY = -5010, 46 AFP_RESULT_FLAT_VOL = -5011, 47 AFP_RESULT_ITEM_NOT_FOUND = -5012, 48 AFP_RESULT_LOCK_ERR = -5013, 49 AFP_RESULT_MISC_ERR = -5014, 50 AFP_RESULT_NO_MORE_LOCKS = -5015, 51 AFP_RESULT_NO_SERVER = -5016, 52 AFP_RESULT_OBJECT_EXISTS = -5017, 53 AFP_RESULT_OBJECT_NOT_FOUND = -5018, 54 AFP_RESULT_PARAM_ERR = -5019, 55 AFP_RESULT_RANGE_NOT_LOCKED = -5020, 56 AFP_RESULT_RANGE_OVERLAP = -5021, 57 AFP_RESULT_SESS_CLOSED = -5022, 58 AFP_RESULT_USER_NOT_AUTH = -5023, 59 AFP_RESULT_CALL_NOT_SUPPORTED = -5024, 60 AFP_RESULT_OBJECT_TYPE_ERR = -5025, 61 AFP_RESULT_TOO_MANY_FILES_OPEN = -5026, 62 AFP_RESULT_SERVER_GOING_DOWN = -5027, 63 AFP_RESULT_CANT_RENAME = -5028, 64 AFP_RESULT_DIR_NOT_FOUND = -5029, 65 AFP_RESULT_ICON_TYPE_ERR = -5030, 66 AFP_RESULT_VOL_LOCKED = -5031, 67 AFP_RESULT_OBJECT_LOCKED = -5032, 68 AFP_RESULT_CONTAINS_SHARED_ERR = -5033, 69 AFP_RESULT_ID_NOT_FOUND = -5034, 70 AFP_RESULT_ID_EXISTS = -5035, 71 AFP_RESULT_DIFF_VOL_ERR = -5036, 72 AFP_RESULT_CATALOG_CHANGED = -5037, 73 AFP_RESULT_SAME_OBJECT_ERR = -5038, 74 AFP_RESULT_BAD_ID_ERR = -5039, 75 AFP_RESULT_PWD_SAME_ERR = -5040, 76 AFP_RESULT_PWD_TOO_SHORT_ERR = -5041, 77 AFP_RESULT_PWD_EXPIRED_ERR = -5042, 78 AFP_RESULT_INSIDE_SHARE_ERR = -5043, 79 AFP_RESULT_INSIDE_TRASH_ERR = -5044, 80 AFP_RESULT_PWD_NEEDS_CHANGE_ERR = -5045, 81 AFP_RESULT_PWD_POLICY_ERR = -5046, 82 AFP_RESULT_DISK_QUOTA_EXCEEDED = -5047 83 } AfpResultCode; 84 85 #define G_FILE_ATTRIBUTE_AFP_NODE_ID "afp::node-id" 86 #define G_FILE_ATTRIBUTE_AFP_PARENT_DIR_ID "afp::parent-dir-id" 87 #define G_FILE_ATTRIBUTE_AFP_CHILDREN_COUNT "afp::children-count" 88 #define G_FILE_ATTRIBUTE_AFP_UA_PERMISSIONS "afp::ua-permisssions" 89 90 GError *afp_result_code_to_gerror (AfpResultCode res_code); 91 92 gboolean is_root (const char *filename); 93 94 #define REPLY_READ_BYTE(reply, val) \ 95 G_STMT_START { \ 96 if (!g_vfs_afp_reply_read_byte (reply, val)) \ 97 goto invalid_reply; \ 98 } G_STMT_END 99 100 #define REPLY_READ_UINT16(reply, val) \ 101 G_STMT_START { \ 102 if (!g_vfs_afp_reply_read_uint16 (reply, val)) \ 103 goto invalid_reply; \ 104 } G_STMT_END 105 106 #define REPLY_READ_UINT32(reply, val) \ 107 G_STMT_START { \ 108 if (!g_vfs_afp_reply_read_uint32 (reply, val)) \ 109 goto invalid_reply; \ 110 } G_STMT_END 111 112 #define REPLY_READ_UINT64(reply, val) \ 113 G_STMT_START { \ 114 if (!g_vfs_afp_reply_read_uint64 (reply, val)) \ 115 goto invalid_reply; \ 116 } G_STMT_END 117 118 #define REPLY_READ_INT32(reply, val) \ 119 G_STMT_START { \ 120 if (!g_vfs_afp_reply_read_int32 (reply, val)) \ 121 goto invalid_reply; \ 122 } G_STMT_END 123 124 #define REPLY_GET_DATA(reply, size, val) \ 125 G_STMT_START { \ 126 if (!g_vfs_afp_reply_get_data (reply, size, val)) \ 127 goto invalid_reply; \ 128 } G_STMT_END 129 130 #define REPLY_READ_PASCAL(reply, is_utf8, val) \ 131 G_STMT_START { \ 132 if (!g_vfs_afp_reply_read_pascal (reply, is_utf8, val)) \ 133 goto invalid_reply; \ 134 } G_STMT_END 135 136 #define REPLY_READ_AFP_NAME(reply, read_text_encoding, val) \ 137 G_STMT_START { \ 138 if (!g_vfs_afp_reply_read_afp_name (reply, read_text_encoding, val)) \ 139 goto invalid_reply; \ 140 } G_STMT_END 141 142 #define REPLY_SKIP_TO_EVEN(reply) \ 143 G_STMT_START { \ 144 if (!g_vfs_afp_reply_skip_to_even (reply)) \ 145 goto invalid_reply; \ 146 } G_STMT_END 147 148 #define REPLY_SEEK(reply, offset, type) \ 149 G_STMT_START { \ 150 if (!g_vfs_afp_reply_seek (reply, offset, type)) \ 151 goto invalid_reply; \ 152 } G_STMT_END 153 154 G_END_DECLS 155 156 #endif /* _GVFSAFPUTILS_H_ */ 157