--- /dev/null
+"""
+Top level functions for parsing and storing information.
+
+2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+"""
+
+import storage
+import parsing
+
+def parse_store_session(writer, parser, session_id):
+ """
+ Parse and store information for a BitTorrent session.
+
+ writer is an instance of the storage.SwarmWriter class.
+ parser is an instance of the parsing.LogParser class (may be
+ LibtorrentLogParser, TriblerLogParser or some other).
+ session_id is the client session id.
+ """
+
+ while True:
+ msg = parser.get_next_message()
+ # In case of no more messages, exit loop.
+ if msg == None:
+ break
+
+ msg.set_client_session_id(session_id)
+ writer.add_message(msg)