An example illustrates how RSS and XML might help in a security application. Suppose a panel device unlocks a door for people who wave the right key card. Further assume that the embedded computer running the panel device incorporates a simple Web server as part of its control functions. The device keeps a log of events that might contain the following information:

struct LogEvent <p>{ </p><p>string time; /* timestamp when this event occurred */ string who; /* who tried to open the door */string status; /* "granted" or "denied" access */ </p><p>}</p>

These logged events could either sit in a file on the device's file system or be kept as a list in main memory. Either way, the firmware has a mechanism for iterating through the entire list of logged events.

To generate the RSS feed of the log events, developers will set up a CGI-based Web application. This application runs within the HTTP Web server that is part of the panel device. Users elsewhere will be able to access this application via a URL associated with the device. The URL will typically have the well-known format of http://device_ip_address/ index.rss. The RSS generator on the device can dynamically create the RSS page and send it back to the client (i.e. RSS aggregator) through code something like:

void HttpRssCallback(httpSocket){ <p>GenerateAndSendRssHeader(httpSocket); </p><p>foreach log event i{ </p><p>GenerateAndSendRssItemData(httpSocket, i) </p><p>} </p><p>}</p>

The "generate" APIs above simply create the necessary RSS format of the given data. Here is an example of an event log and the resulting RSS data:

Logs:

  1. "Wed Jun 14 16:32:32 PDT 2006" "Matt McFadden" "granted"
  2. "Wed Jun 15 04:14:10 PDT 2006" "Eric Davis" "denied"

RSS Feed:

<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <p><channel> </p><p><title>Security Door</title> <link>http://device_ip_address</link> <description>Security Door Event Logs</description> <language>en-us</language> <item> <title>Access Granted</title> <link>http://device_ip_address</link> <description>Granted access for Matt McFadden</description> <pubDate>Wed Jun 14 16:32:32 PDT 2006</pubDate></item> <item><title>Access Denied</title><link>http://device_ip_address</link> <description>Denied access for Eric Davis</description><pubDate>Wed Jun 15 04:14:10 PDT 2006</pubDate> </item></channel></rss></p>

An RSS aggregator is configured to get the RSS feed from the device and then parse the data in a format the user can easily read. In most cases, RSS aggregators present feeds like email clients present mailboxes.

Likewise, applications could use custom XML instead of an RSS feed to expose the event log. The XML data could be pushed or pulled from the device using FTP, TFTP, HTTP, Telnet, Email, or similar protocols. The same logs above encoded as custom XML might look like:

<?xml version="1.0" standalone="yes"?><security_door_log_events><logevent> <time>Wed Jun 14 16:32:32 PDT 2006</time><who>Matt McFadden</who><status>granted</status></logevent> <logevent> <time>Wed Jun 15 04:14:10 PDT 2006</time><who>Eric Davis</who> <status>denied</status></logevent> </security_door_log_events>

It's customary when using custom XML to implement a back-end program or script to parse the data, interpret it, and do something useful. In the above case, an example might be to send the office manager an email noting that access was denied to Eric Davis.