Cleanup: Refactoring XML output code to facilitate introduction of protocol xml output.
This commit is contained in:
parent
dc4432a18f
commit
9cc323004c
43
src/xmlout.c
43
src/xmlout.c
@ -676,6 +676,30 @@ xmlRoleEventlist (const System sys, Roledef rd, int index)
|
||||
xmlPrint ("</eventlist>");
|
||||
}
|
||||
|
||||
//! Output a protocol description
|
||||
void
|
||||
xmlProtocol (const System sys, Protocol p)
|
||||
{
|
||||
Role r;
|
||||
|
||||
xmlPrint ("<protocol>");
|
||||
xmlindent++;
|
||||
xmlOutTerm ("name", p->nameterm);
|
||||
r = p->roles;
|
||||
while (r != NULL)
|
||||
{
|
||||
xmlPrint ("<role>");
|
||||
xmlindent++;
|
||||
xmlRoleTermPrint (r->nameterm);
|
||||
xmlRoleEventlist (sys, r->roledef, 0);
|
||||
xmlindent--;
|
||||
xmlPrint ("</role>");
|
||||
r = r->next;
|
||||
}
|
||||
xmlindent--;
|
||||
xmlPrint ("</protocol>");
|
||||
}
|
||||
|
||||
//! Show all protocol roles that are in the attack.
|
||||
void
|
||||
xmlInvolvedProtocolRoles (const System sys)
|
||||
@ -687,24 +711,7 @@ xmlInvolvedProtocolRoles (const System sys)
|
||||
{
|
||||
if (isProtocolInvolved (sys, p))
|
||||
{
|
||||
Role r;
|
||||
|
||||
xmlPrint ("<protocol>");
|
||||
xmlindent++;
|
||||
xmlOutTerm ("name", p->nameterm);
|
||||
r = p->roles;
|
||||
while (r != NULL)
|
||||
{
|
||||
xmlPrint ("<role>");
|
||||
xmlindent++;
|
||||
xmlRoleTermPrint (r->nameterm);
|
||||
xmlRoleEventlist (sys, r->roledef, 0);
|
||||
xmlindent--;
|
||||
xmlPrint ("</role>");
|
||||
r = r->next;
|
||||
}
|
||||
xmlindent--;
|
||||
xmlPrint ("</protocol>");
|
||||
xmlProtocol (sys, p);
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user