PER:
Adapt dissect_per_octet_string to unaligned PER. Call rrlp dissector from ulp dissector. svn path=/trunk/; revision=18176
This commit is contained in:
parent
4b6b84d515
commit
622f6d8922
|
@ -471,9 +471,11 @@ SUPLPOS ::= SEQUENCE {
|
|||
PosPayLoad ::= CHOICE {
|
||||
tia801payload OCTET STRING(SIZE (1..8192)),
|
||||
rrcPayload OCTET STRING(SIZE (1..8192)),
|
||||
rrlpPayload OCTET STRING(SIZE (1..8192)),
|
||||
rrlpPayload RRLPPayload,
|
||||
...}
|
||||
|
||||
RRLPPayload ::= OCTET STRING(SIZE (1..8192))
|
||||
|
||||
--END
|
||||
--SUPL-POS-INIT DEFINITIONS AUTOMATIC TAGS ::=
|
||||
--BEGIN
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#define PFNAME "ulp"
|
||||
|
||||
static dissector_handle_t ulp_handle=NULL;
|
||||
static dissector_handle_t rrlp_handle;
|
||||
|
||||
/* IANA Registered Ports
|
||||
* oma-ulp 7275/tcp OMA UserPlane Location
|
||||
|
@ -82,6 +83,8 @@ proto_reg_handoff_ulp(void)
|
|||
/* application/oma-supl-ulp */
|
||||
dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle);
|
||||
|
||||
rrlp_handle = find_dissector("rrlp");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,12 @@ guint32 UlpMessage;
|
|||
}
|
||||
#.END
|
||||
|
||||
#.TYPE_ATTR
|
||||
IPv4Address TYPE = FT_IPv4 DISPLAY = BASE_NONE STRINGS = NULL
|
||||
IPv6Address TYPE = FT_IPv6 DISPLAY = BASE_NONE STRINGS = NULL
|
||||
#.FN_BODY RRLPPayload VAL_PTR = &rrlp_tvb
|
||||
tvbuff_t *rrlp_tvb;
|
||||
|
||||
%(DEFAULT_BODY)s
|
||||
|
||||
if (rrlp_tvb){
|
||||
call_dissector(rrlp_handle, rrlp_tvb, pinfo, tree);
|
||||
|
||||
}
|
|
@ -1452,6 +1452,7 @@ dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, prot
|
|||
static guint8 bytes[4];
|
||||
guint8 *pbytes = NULL;
|
||||
proto_item *pi;
|
||||
tvbuff_t *out_tvb = NULL;
|
||||
|
||||
hfi = (hf_index==-1) ? NULL : proto_registrar_get_nth(hf_index);
|
||||
|
||||
|
@ -1485,12 +1486,30 @@ DEBUG_ENTRY("dissect_per_octet_string");
|
|||
|
||||
} else if ((min_len==max_len)&&(min_len<65536)) { /* 16.7 if length is fixed and less than to 64k*/
|
||||
/* align to byte */
|
||||
|
||||
if (is_per_byte_aligned)
|
||||
BYTE_ALIGN_OFFSET(offset);
|
||||
val_start = offset>>3;
|
||||
val_length = min_len;
|
||||
offset+=min_len*8;
|
||||
val_start = offset>>3;
|
||||
|
||||
if (is_per_byte_aligned){
|
||||
BYTE_ALIGN_OFFSET(offset);
|
||||
val_length = min_len;
|
||||
offset+=min_len*8;
|
||||
}else{
|
||||
guint8 *buff;
|
||||
guint32 i = 0;
|
||||
guint32 j = 0;
|
||||
gboolean bit;
|
||||
|
||||
buff = ep_alloc(min_len);
|
||||
while (j < (guint32)min_len){
|
||||
for(i=0;i<8;i++){
|
||||
offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL);
|
||||
buff[j]=(buff[j]<<1)|bit;
|
||||
}
|
||||
j = j+1;
|
||||
}
|
||||
pbytes = buff;
|
||||
val_length = min_len;
|
||||
/* XXX should we return a new tvb with the octetstring? */
|
||||
}
|
||||
|
||||
} else { /* 16.8 */
|
||||
if(max_len>0) {
|
||||
|
@ -1505,12 +1524,35 @@ DEBUG_ENTRY("dissect_per_octet_string");
|
|||
|
||||
if(length){
|
||||
/* align to byte */
|
||||
if (is_per_byte_aligned)
|
||||
if (is_per_byte_aligned){
|
||||
BYTE_ALIGN_OFFSET(offset);
|
||||
offset+=length*8;
|
||||
val_start = offset>>3;
|
||||
}else{
|
||||
guint8 *buff;
|
||||
guint32 i = 0;
|
||||
guint32 j = 0;
|
||||
gboolean bit;
|
||||
|
||||
val_start = offset>>3;
|
||||
buff = g_malloc(length);
|
||||
while (j < length){
|
||||
for(i=0;i<8;i++){
|
||||
offset=dissect_per_boolean(tvb, offset, pinfo, tree, -1, &bit, NULL);
|
||||
buff[j]=(buff[j]<<1)|bit;
|
||||
}
|
||||
j = j+1;
|
||||
}
|
||||
pbytes = buff;
|
||||
out_tvb = tvb_new_real_data(buff,length,length);
|
||||
/* Arrange that the allocated packet data copy be freed when the
|
||||
* tvbuff is freed.
|
||||
*/
|
||||
tvb_set_free_cb(out_tvb, g_free );
|
||||
tvb_set_child_real_data_tvbuff(tvb,out_tvb);
|
||||
}
|
||||
}
|
||||
val_start = offset>>3;
|
||||
val_length = length;
|
||||
offset+=length*8;
|
||||
}
|
||||
|
||||
if (hfi) {
|
||||
|
@ -1535,7 +1577,10 @@ DEBUG_ENTRY("dissect_per_octet_string");
|
|||
}
|
||||
}
|
||||
if (value_tvb)
|
||||
*value_tvb = tvb_new_subset(tvb, val_start, val_length, val_length);
|
||||
if (out_tvb)
|
||||
*value_tvb = out_tvb;
|
||||
else
|
||||
*value_tvb = tvb_new_subset(tvb, val_start, val_length, val_length);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#define PFNAME "ulp"
|
||||
|
||||
static dissector_handle_t ulp_handle=NULL;
|
||||
static dissector_handle_t rrlp_handle;
|
||||
|
||||
/* IANA Registered Ports
|
||||
* oma-ulp 7275/tcp OMA UserPlane Location
|
||||
|
@ -206,7 +207,7 @@ static int hf_ulp_clientNameType = -1; /* FormatIndicator */
|
|||
static int hf_ulp_posPayLoad = -1; /* PosPayLoad */
|
||||
static int hf_ulp_tia801payload = -1; /* OCTET_STRING_SIZE_1_8192 */
|
||||
static int hf_ulp_rrcPayload = -1; /* OCTET_STRING_SIZE_1_8192 */
|
||||
static int hf_ulp_rrlpPayload = -1; /* OCTET_STRING_SIZE_1_8192 */
|
||||
static int hf_ulp_rrlpPayload = -1; /* RRLPPayload */
|
||||
static int hf_ulp_sETCapabilities = -1; /* SETCapabilities */
|
||||
static int hf_ulp_requestedAssistData = -1; /* RequestedAssistData */
|
||||
static int hf_ulp_locationId = -1; /* LocationId */
|
||||
|
@ -246,7 +247,7 @@ static int hf_ulp_rrlp = -1; /* BOOLEAN */
|
|||
static int hf_ulp_rrc = -1; /* BOOLEAN */
|
||||
|
||||
/*--- End of included file: packet-ulp-hf.c ---*/
|
||||
#line 63 "packet-ulp-template.c"
|
||||
#line 64 "packet-ulp-template.c"
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_ulp = -1;
|
||||
|
@ -313,7 +314,7 @@ static gint ett_ulp_PosTechnology = -1;
|
|||
static gint ett_ulp_PosProtocol = -1;
|
||||
|
||||
/*--- End of included file: packet-ulp-ett.c ---*/
|
||||
#line 67 "packet-ulp-template.c"
|
||||
#line 68 "packet-ulp-template.c"
|
||||
|
||||
/* Include constants */
|
||||
|
||||
|
@ -326,7 +327,7 @@ static gint ett_ulp_PosProtocol = -1;
|
|||
#define maxClientLength 50
|
||||
|
||||
/*--- End of included file: packet-ulp-val.h ---*/
|
||||
#line 70 "packet-ulp-template.c"
|
||||
#line 71 "packet-ulp-template.c"
|
||||
|
||||
|
||||
/*--- Included file: packet-ulp-fn.c ---*/
|
||||
|
@ -2315,8 +2316,27 @@ static int dissect_tia801payload(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
static int dissect_rrcPayload(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
|
||||
return dissect_ulp_OCTET_STRING_SIZE_1_8192(tvb, offset, pinfo, tree, hf_ulp_rrcPayload);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
dissect_ulp_RRLPPayload(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
#line 33 "ulp.cnf"
|
||||
tvbuff_t *rrlp_tvb;
|
||||
|
||||
offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index,
|
||||
1, 8192, &rrlp_tvb);
|
||||
|
||||
|
||||
if (rrlp_tvb){
|
||||
call_dissector(rrlp_handle, rrlp_tvb, pinfo, tree);
|
||||
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_rrlpPayload(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
|
||||
return dissect_ulp_OCTET_STRING_SIZE_1_8192(tvb, offset, pinfo, tree, hf_ulp_rrlpPayload);
|
||||
return dissect_ulp_RRLPPayload(tvb, offset, pinfo, tree, hf_ulp_rrlpPayload);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2646,7 +2666,7 @@ static void dissect_ULP_PDU_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
|||
|
||||
|
||||
/*--- End of included file: packet-ulp-fn.c ---*/
|
||||
#line 72 "packet-ulp-template.c"
|
||||
#line 73 "packet-ulp-template.c"
|
||||
|
||||
/*--- proto_reg_handoff_ulp ---------------------------------------*/
|
||||
void
|
||||
|
@ -2660,6 +2680,8 @@ proto_reg_handoff_ulp(void)
|
|||
/* application/oma-supl-ulp */
|
||||
dissector_add_string("media_type","application/oma-supl-ulp", ulp_handle);
|
||||
|
||||
rrlp_handle = find_dissector("rrlp");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2786,11 +2808,11 @@ void proto_register_ulp(void) {
|
|||
"SlpSessionID/slpId", HFILL }},
|
||||
{ &hf_ulp_ipv4Address,
|
||||
{ "ipv4Address", "ulp.ipv4Address",
|
||||
FT_IPv4, BASE_NONE, NULL, 0,
|
||||
FT_BYTES, BASE_HEX, NULL, 0,
|
||||
"IPAddress/ipv4Address", HFILL }},
|
||||
{ &hf_ulp_ipv6Address,
|
||||
{ "ipv6Address", "ulp.ipv6Address",
|
||||
FT_IPv6, BASE_NONE, NULL, 0,
|
||||
FT_BYTES, BASE_HEX, NULL, 0,
|
||||
"IPAddress/ipv6Address", HFILL }},
|
||||
{ &hf_ulp_fQDN,
|
||||
{ "fQDN", "ulp.fQDN",
|
||||
|
@ -3370,7 +3392,7 @@ void proto_register_ulp(void) {
|
|||
"PosProtocol/rrc", HFILL }},
|
||||
|
||||
/*--- End of included file: packet-ulp-hfarr.c ---*/
|
||||
#line 95 "packet-ulp-template.c"
|
||||
#line 98 "packet-ulp-template.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
|
@ -3439,7 +3461,7 @@ void proto_register_ulp(void) {
|
|||
&ett_ulp_PosProtocol,
|
||||
|
||||
/*--- End of included file: packet-ulp-ettarr.c ---*/
|
||||
#line 101 "packet-ulp-template.c"
|
||||
#line 104 "packet-ulp-template.c"
|
||||
};
|
||||
|
||||
module_t *ulp_module;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Do not modify this file. */
|
||||
/* It is created automatically by the ASN.1 to Ethereal dissector compiler */
|
||||
/* .\packet-ulp.h */
|
||||
/* ../../tools/asn2eth.py -X -e -p ulp -c ulp.cnf -s packet-ulp-template ULP.asn */
|
||||
/* ../../tools/asn2eth.py -u -e -p ulp -c ulp.cnf -s packet-ulp-template ULP.asn */
|
||||
|
||||
/* Input file: packet-ulp-template.h */
|
||||
|
||||
|
|
Loading…
Reference in New Issue