From Alex deVries (bug 2486):

This adds fpSyncFork and fpSyncDir functionality to the AFP dissector.

svn path=/trunk/; revision=25142
This commit is contained in:
Stig Bjørlykke 2008-04-21 21:36:11 +00:00
parent 5ddabf170f
commit 5ccc52fbb6
2 changed files with 133 additions and 9 deletions

View File

@ -160,6 +160,10 @@ http://developer.apple.com/documentation/Networking/Reference/AFP_Reference/inde
#define AFP_SETACL 74
#define AFP_ACCESS 75
/* AFP 3.2 calls added in 10.5 */
#define AFP_SYNCDIR 78
#define AFP_SYNCFORK 79
/* ----------------------------- */
static int proto_afp = -1;
static int hf_afp_reserved = -1;
@ -422,6 +426,8 @@ const value_string CommandCode_vals[] = {
{AFP_GETACL, "FPGetACL" },
{AFP_SETACL, "FPSetACL" },
{AFP_ACCESS, "FPAccess" },
{AFP_SYNCFORK, "FPSyncFork" },
{AFP_SYNCDIR, "FPSyncDir" },
{0, NULL }
};
@ -2638,6 +2644,7 @@ dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
fork number
AFP_FLUSHFORK
AFP_CLOSEFORK
AFP_SYNCFORK
*/
static gint
dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
@ -3850,6 +3857,19 @@ dissect_query_afp_access(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
return offset;
}
/* ************************** */
static gint
dissect_query_afp_with_did(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
{
PAD(1);
offset = decode_vol_did(tree, tvb, offset);
proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
offset += 4;
return offset;
}
/* ************************** */
static guint16
decode_acl_list_bitmap(tvbuff_t *tvb, proto_tree *tree, gint offset)
@ -4143,6 +4163,7 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case AFP_CLOSEDT:
offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset);break;
case AFP_FLUSHFORK: /* same packet as closefork */
case AFP_SYNCFORK:
case AFP_CLOSEFORK:
offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset);break;
case AFP_COPYFILE:
@ -4258,6 +4279,8 @@ dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = dissect_query_afp_set_acl(tvb, pinfo, afp_tree, offset);break;
case AFP_ACCESS:
offset = dissect_query_afp_access(tvb, pinfo, afp_tree, offset);break;
case AFP_SYNCDIR:
offset = dissect_query_afp_with_did(tvb, pinfo, afp_tree, offset);break;
}
}
else {

View File

@ -195,6 +195,110 @@ slice(fvalue_t *fv, GByteArray *bytes, guint offset, guint length)
}
}
static gboolean
cmp_eq(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
if (a_len != tvb_length(b)) {
return FALSE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) == 0);
}
static gboolean
cmp_ne(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
if (a_len != tvb_length(b)) {
return TRUE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) != 0);
}
static gboolean
cmp_gt(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
guint b_len = tvb_length(b);
if (a_len > b_len) {
return TRUE;
}
if (a_len < b_len) {
return FALSE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) > 0);
}
static gboolean
cmp_ge(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
guint b_len = tvb_length(b);
if (a_len > b_len) {
return TRUE;
}
if (a_len < b_len) {
return FALSE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) >= 0);
}
static gboolean
cmp_lt(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
guint b_len = tvb_length(b);
if (a_len < b_len) {
return TRUE;
}
if (a_len > b_len) {
return FALSE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) < 0);
}
static gboolean
cmp_le(fvalue_t *fv_a, fvalue_t *fv_b)
{
tvbuff_t *a = fv_a->value.tvb;
tvbuff_t *b = fv_b->value.tvb;
guint a_len = tvb_length(a);
guint b_len = tvb_length(b);
if (a_len < b_len) {
return TRUE;
}
if (a_len > b_len) {
return FALSE;
}
return (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) <= 0);
}
static gboolean
cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b)
{
@ -281,15 +385,12 @@ ftype_register_tvbuff(void)
NULL, /* get_value_integer64 */
NULL, /* get_value_floating */
/* TODO - tvb's *can* do 'eq', etc. */
NULL, /* cmp_eq */
NULL, /* cmp_ne */
NULL, /* cmp_gt */
NULL, /* cmp_ge */
NULL, /* cmp_lt */
NULL, /* cmp_le */
cmp_eq,
cmp_ne,
cmp_gt,
cmp_ge,
cmp_lt,
cmp_le,
NULL, /* cmp_bitwise_and */
cmp_contains,
CMP_MATCHES,