Module_Overview.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. There are two sets of modules involved in this system, one set lives
  2. on each bus (we will call them Client Side), and those that live on the
  3. central server (we will calal them Server Side).
  4. --------------------------------------------------
  5. Client Side Modules
  6. --------------------------------------------------
  7. Module Name: PPP Dialer
  8. Module Function:
  9. Maintains connection with the server as much as possible using pppd
  10. to set up a gprs internet connection, and then using an ssh client to set up
  11. secure tunnels for each of the underlying Client->Server protocols
  12. implemented by the other modules.
  13. Module Files: (these files live in /etc/ppp/)
  14. ppp-dialer.sh (script to manage ppp connection and SSH tunnels)
  15. pap-secrets (password file for bogus user that modem needs)
  16. chap-secrets (same as above)
  17. ip-down.local (script to run when pppd link does down)
  18. ip-up.local (script to run when pppd link comes up)
  19. options (global pppd options)
  20. chat/disconnect (modem disconnect sequence)
  21. chat/gprs (modem init sequence, gprs specific dial string)
  22. peers/gprs (modem location, gprs specific pppd settings)
  23. Module Outputs:
  24. /tmp/network-is-up (this file is present when ppp0 is up)
  25. /tmp/tunnel-is-up (this file is present when SSH tunnel is up)
  26. /tmp/ssh_tunnel.pid (pidfile for ssh client implementing tunnel)
  27. -------------------
  28. Module Name: Client Supervisor
  29. Module Function:
  30. This module serves a function for our application (as a set of
  31. client modules) as init servers for UNIX. It is responsible for spawning
  32. a supplied set of other modules and gathering any log messages they may
  33. generate and routing them to the correct logging location. It also performs
  34. "aliveness" monitoring for all of the child modules it spawns, resetting any
  35. module that has hung (and logging it), as defined by not getting PONG
  36. messages back from a module that's been sent a PING message through the IPC
  37. hub. This provides a sanity check that will log (for debugging/improvement)
  38. any crashed process, but will also respawn it to maintain maximum system
  39. functionality.
  40. Module Files: (these files live in the bin directory)
  41. client_supervisor (the binary executable)
  42. -------------------
  43. Module Name: IPC Hub
  44. Module Function:
  45. This module serves as a communication hub for all of the other
  46. modules to send notifications, requests, and data structures to one another
  47. in an efficient manner. It provides a UNIX domain socket in /tmp which
  48. client processes can connect to and then subscribe to mailboxes, as well as
  49. send messages to mailboxes. Every message sent to a mailbox gets delivered
  50. to each process with an active subscription to that mailbox. This module
  51. also provides a wiretap feature which allows a debug client to attach to a
  52. running system and watch the messages as they flow through the hub allowing
  53. live trouble shooting.
  54. Module Files:
  55. /tmp/commhub (UNIX domain socket to which clients connect)
  56. ipc_server (this is the executable for this module)
  57. debug_client (this is the wiretap client for live debug)
  58. -------------------
  59. Module Name: Billing Database Client
  60. Module Function:
  61. This module collects submissions of billing and diagnostic log
  62. messages from other modules through its IPC mailbox and stores them in a
  63. transaction synchronous local database. When an SSH tunnel is available to
  64. the central server, it will attempt to flush any message that hasn't yet
  65. been confirmed by the server, retransmitting as needed.
  66. Module Files:
  67. billing.mem (mmap()-able file containing database of log entries)
  68. billdb (billing database client)
  69. -------------------
  70. Module Name: Pass Database Client
  71. Module Function:
  72. This module maintains a transaction synchronous local database of
  73. riders (rider ID, Magstripe, RFID, Rule, Rule Parameter) which is kept up to
  74. date with the server whenever there is an SSH tunnel available.
  75. This module also listens to the mailboxes for incoming credentials
  76. from the passenger interface unit and looks them up in the database. If a
  77. rider record is found for that credential, the associated rule is applied
  78. which will generate a billing log entry (and possibly passenger interface
  79. and driver interface messages).
  80. Module Files:
  81. passes.mem (mmap()-able file containing database of riders)
  82. passdb (buspass database client)
  83. init.scm (library initialization for scheme interpreter)
  84. rules.scm (scheme definitions for rules attached to riders)
  85. -------------------
  86. Module Name: Passenger Interface Unit
  87. Module Function:
  88. This module communicates with the Passenger Interface Unit connected
  89. by serial port and reports any credential presentation events to the
  90. appropriate mailbox on the IPC hub. This module also listens to a mailbox
  91. on the IPC hub for commands instructing it to update the text on the
  92. passenger facing display.
  93. Module Files:
  94. piu_minder (executable file for PIU module)
  95. -------------------
  96. Module Name: AVLS Client
  97. Module Function:
  98. This module provides Automatic Vehicle Location Service data to the
  99. server as connectivity allows, sending the current vehicle location,
  100. heading, velocity, and information about who is logged in and what route is
  101. being driven to the server whenever there is an SSH tunnel available.
  102. Module Files:
  103. avls (executable for AVLS client)
  104. --------------------------------------------------
  105. Server Side Modules
  106. --------------------------------------------------
  107. Module Name: Bus Pass Server
  108. Module Function:
  109. This module responds to client busses when they ask for rider and
  110. pass updates. It maintains a unique sequence number for each update and
  111. when requested gathers a list of the latest change to each rider after any
  112. given sequence number. This constitutes enough information to bring a
  113. client up to date. If a client is too far out of date, or if the client
  114. requests it explicitly, the server will send a ZFLUSH command, followed by a
  115. compressed list of all valid riders, followed by a ZFLUSHDONE command. This
  116. allows a stale client to efficiently get to an up-to-date state.
  117. -------------------
  118. Module Name: Billing Log Server
  119. Module Function:
  120. This module responds to a client's submitted log entry (billing or
  121. diagnostic log) by responding with (ACK, DUP, or IGN) messages followed by
  122. the MD5 checksum of the submitted message. This response allows the client
  123. to be sure that the message has been logged in the central database, and may
  124. therefore be purged from the local database where storage space is at a
  125. premium.