Reindent some to improve readability

svn path=/trunk/; revision=23510
This commit is contained in:
Jeff Morriss 2007-11-20 16:51:14 +00:00
parent e11ec68f93
commit be81aa150e
1 changed files with 90 additions and 69 deletions

View File

@ -82,10 +82,12 @@ static const value_string k12_port_types[] = {
{ K12_PORT_DS1, "Ds1" },
{ K12_PORT_DS0S, "Ds0 Range" },
{ K12_PORT_ATMPVC, "ATM PVC" },
{ 0,NULL}
{ 0, NULL }
};
static void fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint length) {
static void
fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint length)
{
guint adj = 0;
/* 0x11=control frame 0x30=data frame */
guint info_type = pntohs(extra_info);
@ -97,8 +99,7 @@ static void fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint length) {
if (!p_fp_info || length < 22)
return;
/* Format used by K15, later fields are
shifted by 8 bytes. */
/* Format used by K15, later fields are shifted by 8 bytes. */
if (pntohs(extra_info+2) == 5)
adj = 8;
@ -174,7 +175,9 @@ static void fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint length) {
}
}
static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
static void
dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
{
static dissector_handle_t data_handles[] = {NULL,NULL};
proto_item* k12_item;
proto_tree* k12_tree;
@ -183,7 +186,8 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
dissector_handle_t* handles;
guint i;
k12_item = proto_tree_add_protocol_format(tree, proto_k12, tvb, 0, 0, "Packet from: '%s' (0x%.8x)",
k12_item = proto_tree_add_protocol_format(tree, proto_k12, tvb, 0, 0,
"Packet from: '%s' (0x%.8x)",
pinfo->pseudo_header->k12.input_name,
pinfo->pseudo_header->k12.input);
@ -215,10 +219,13 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
*/
pinfo->circuit_id = g_str_hash(circuit_str);
proto_tree_add_uint(k12_tree, hf_k12_atm_vp, tvb, 0,0,pinfo->pseudo_header->k12.input_info.atm.vp);
proto_tree_add_uint(k12_tree, hf_k12_atm_vc, tvb, 0,0,pinfo->pseudo_header->k12.input_info.atm.vc);
proto_tree_add_uint(k12_tree, hf_k12_atm_vp, tvb, 0, 0,
pinfo->pseudo_header->k12.input_info.atm.vp);
proto_tree_add_uint(k12_tree, hf_k12_atm_vc, tvb, 0, 0,
pinfo->pseudo_header->k12.input_info.atm.vc);
if (pinfo->pseudo_header->k12.input_info.atm.cid)
proto_tree_add_uint(k12_tree, hf_k12_atm_cid, tvb, 0,0,pinfo->pseudo_header->k12.input_info.atm.cid);
proto_tree_add_uint(k12_tree, hf_k12_atm_cid, tvb, 0, 0,
pinfo->pseudo_header->k12.input_info.atm.cid);
break;
}
default:
@ -297,14 +304,17 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
call_dissector(sub_handle, tvb, pinfo, tree);
}
static void k12_update_cb(void* r, const char** err) {
static void
k12_update_cb(void* r, const char** err)
{
k12_handles_t* h = r;
gchar** protos;
guint num_protos, i;
protos = ep_strsplit(h->protos,":",0);
for (num_protos = 0; protos[num_protos]; num_protos++) g_strstrip(protos[num_protos]);
for (num_protos = 0; protos[num_protos]; num_protos++)
g_strstrip(protos[num_protos]);
if (h->handles) g_free(h->handles);
@ -321,13 +331,16 @@ static void k12_update_cb(void* r, const char** err) {
*err = NULL;
}
static void* k12_copy_cb(void* dest, const void* orig, unsigned len _U_) {
static void*
k12_copy_cb(void* dest, const void* orig, unsigned len _U_)
{
k12_handles_t* d = dest;
const k12_handles_t* o = orig;
gchar** protos = ep_strsplit(d->protos,":",0);
guint num_protos;
for (num_protos = 0; protos[num_protos]; num_protos++) g_strstrip(protos[num_protos]);
for (num_protos = 0; protos[num_protos]; num_protos++)
g_strstrip(protos[num_protos]);
d->match = g_strdup(o->match);
d->protos = g_strdup(o->protos);
@ -336,7 +349,9 @@ static void* k12_copy_cb(void* dest, const void* orig, unsigned len _U_) {
return dest;
}
static void k12_free_cb(void* r) {
static void
k12_free_cb(void* r)
{
k12_handles_t* h = r;
if (h->match) g_free(h->match);
if (h->protos) g_free(h->protos);
@ -344,7 +359,9 @@ static void k12_free_cb(void* r) {
}
static gboolean protos_chk_cb(void* r _U_, const char* p, unsigned len, void* u1 _U_, void* u2 _U_, const char** err) {
static gboolean
protos_chk_cb(void* r _U_, const char* p, unsigned len, void* u1 _U_, void* u2 _U_, const char** err)
{
gchar** protos;
gchar* line = ep_strndup(p,len);
guint num_protos, i;
@ -354,7 +371,8 @@ static gboolean protos_chk_cb(void* r _U_, const char* p, unsigned len, void* u1
protos = ep_strsplit(line,":",0);
for (num_protos = 0; protos[num_protos]; num_protos++) g_strstrip(protos[num_protos]);
for (num_protos = 0; protos[num_protos]; num_protos++)
g_strstrip(protos[num_protos]);
if (!num_protos) {
*err = ep_strdup_printf("No protocols given");
@ -375,7 +393,9 @@ UAT_CSTRING_CB_DEF(k12,match,k12_handles_t)
UAT_CSTRING_CB_DEF(k12,protos,k12_handles_t)
/* Make sure handles for various protocols are initialized */
static void initialize_handles_once(void) {
static void
initialize_handles_once(void)
{
static gboolean initialized = FALSE;
if (!initialized) {
k12_handle = find_dissector("k12");
@ -386,7 +406,8 @@ static void initialize_handles_once(void) {
}
}
void proto_reg_handoff_k12(void) {
void proto_reg_handoff_k12(void)
{
initialize_handles_once();
dissector_add("wtap_encap", WTAP_ENCAP_K12, k12_handle);
}
@ -438,7 +459,7 @@ proto_register_k12(void)
k12_copy_cb,
k12_update_cb,
k12_free_cb,
uat_k12_flds );
uat_k12_flds);
k12_module = prefs_register_protocol(proto_k12, NULL);