+public class TrustAnchor : Object
+{
+ public string ca_cert {get; set; default = null;}
+ public string subject {get; set; default = null;}
+ public string subject_alt {get; set; default = null;}
+ public string server_cert {get; set; default = null;}
+}
+
+public class IdCard : Object
+{
+ public string display_name { get; set; default = null; }
+
+ public string username { get; set; default = null; }
+ public string password { get; set; default = null; }
-class IdCard : Object {
+ public string issuer { get; set; default = null; }
- public Gdk.Pixbuf pixbuf {get; set; default = null; }
- public string issuer { get; set; default = null; }
- public string username { get; set; default = null; }
- public string password { get; set; default = null; }
- public string[] services { get; set; default = null; }
- public string nai { get; set; default = null; }
+ public TrustAnchor trust_anchor { get; set; default = new TrustAnchor (); }
+
+ public Gdk.Pixbuf pixbuf { get; set; default = null; }
+ public string[] services { get; set; default = null; }
+ //TODO: Set the getter and remove the setter/default
+ public string nai { get; set; default = null; }
}
namespace WebProvisioning
-{
- class WebProvisionParser
+{
+ public IdCard card;
+
+ public void text_element_func (MarkupParseContext context,
+ string text,
+ size_t text_len) throws MarkupError
{
- public WebProvisionParser (string path)
+ unowned SList<string> stack = context.get_element_stack ();
+
+ if (stack.nth_data(0) == "display-name")
{
}
- }
-
- public void start_element_func (MarkupParseContext context,
- string element_name,
- string[] attribute_names,
- string[] attribute_values) throws MarkupError
- {
- debug ("Start: %s", element_name);
- }
- public void end_element_func (MarkupParseContext context,
- string element_name) throws MarkupError
- {
- debug ("End: %s", element_name);
+
}
-
- public void text_element_func (MarkupParseContext context,
- string text,
- size_t text_len) throws MarkupError
+
+ class WebProvisionParser
{
- debug ("Text element: %s", text);
- foreach (string elm in context.get_element_stack ())
+ public WebProvisionParser (string path)
{
- stdout.printf("%s\n", elm);
+ string text = "";
+ var file = File.new_for_path (path);
+
+ try
+ {
+ var dis = new DataInputStream (file.read ());
+ string line;
+ while ((line = dis.read_line (null)) != null)
+ text += line;
+ }
+ catch (Error e)
+ {
+ error ("Could not retreive file size");
+ }
+
+ MarkupParser parser = {null, null, text_element_func, null, null};
+
+ var ctx = new MarkupParseContext(parser, 0, null, null);
+
+ try
+ {
+ ctx.parse (text, text.length);
+ }
+ catch (Error e)
+ {
+ error ("Could not parse %s, invalid content", path);
+ }
}
}
-
public static int main (string[] args)
{
- string text = "";
if (args.length < 2)
{
error ("Usage %s [-a] WEB_PROVISIONING_FILE", args[0]);
error ("%s does not exist", args[1]);
}
- var file = File.new_for_path (args[1]);
-
- try
- {
- var dis = new DataInputStream (file.read ());
- string line;
- while ((line = dis.read_line (null)) != null)
- text += line;
- }
- catch (Error e)
- {
- error ("Could not retreive file size");
- }
-
- MarkupParser parser = {start_element_func, end_element_func, text_element_func, null, null};
-
- var ctx = new MarkupParseContext(parser, 0, null, null);
-
- try
- {
- ctx.parse (text, text.length);
- }
- catch (Error e)
- {
- error ("Could not parse %s, invalid content", args[1]);
- }
-
-
+ var webp = new WebProvisionParser (args[1]);
+
return 0;
}
}