use kdelibs icon and fix slot
[kdenetwork.git] / kpf / DESIGN
blob7f5d9fa9bf808fcdaab770d8e212eb8fcf1857d8
1 Applet creation:
3 kicker creates an Applet object via the extern "C" `init' function in
4 Applet.cpp
6 Structure:
8 The main classes:
10 ActiveMonitor
12   Shows a list of ActiveMonitorItem objects.
14 ActiveMonitorItem
16   Shows details of a request belonging to a Server object.
18 Applet
20   Contains a set of AppletItem.
22 AppletItem
24   Contains a BandwidthGraph and additionally provides a popup menu.
25   
26 BandwidthGraph
28   Shows a graph of the bandwidth usage of a Server object.
30 Server
32   Serves requests on a connection from a remote client.
33   May serve more than one request per connection (this is HTTP persistence.)
34   Creates Request object on incoming request.
35   Creates Response object when incoming request is fully received.
36   Sends Request and Response objects out via signals, so that they
37   may be used by ActiveMonitorItem objects.
39 WebServer
41   Listens for incoming requests.
42   Creates and manages Server objects.
44 WebServerManager
46   Singleton.
47   Creates and manages WebServer objects.
49 Startup:
51 1.  Applet creates WebServerManager singleton (requests pointer to instance.)
52 2.  WebServerManager reads config and creates WebServers.
53 3.  Applet is informed via signal as each WebServer is created, and creates
54     AppletItem for each.
55 4.  AppletItem creates BandwidthGraph.
56 5.  BandwidthGraph connects itself to the new WebServer.
57 6.  Repeated until all saved WebServers have been created.
58 7.  Return to event loop.
60 Creation of server by user:
62 1.  Via Konqueror properties dialog plugin, context menu on AppletItem, or
63     context menu on `bare' Applet, user is asked to configure server.
64     From the Konqueror plugin, a simple configuration interface is used.
65     From the context menu on the AppletItem or Applet, a ServerWizard is
66     created.
67 2.  If a WebServer is created (user accepts) then the Applet is informed
68     and the procedure continues as in Startup, step 4.
70 Run cycle:
72 1.  Connection received by a WebServer.
73 2.  WebServer checks connection limit, if OK creates Server.
74 3.  Server creates Request object from data supplied by client.
75 4.  Server emits request(), passing Request object.
76 5.  WebServer emits request(), passing Request object.
77 6.  ActiveMonitor creates ActiveMonitorItem using Request object data.
78 7.  Server generates appropriate Response object.
79 8.  Server emits response(), passing Response object.
80 9.  WebServer emits response(), passing Response object.
81 10. ActiveMonitor passes Response to relevant ActiveMonitorItem, which updates.
82 11. Server passes data to client.
83 12. Server emits finished().
84 13. WebServer emits finished().
85 14. ActiveMonitor informs relevant ActiveMonitorItem that Server is finished.
86 15. WebServer deletes Server.
87 16. (after delay) ActiveMonitorItem is removed by ActiveMonitor.
89 Bandwidth limiting:
91 Limiting really applies to outgoing traffic only. If `too much' incoming
92 traffic is received by a Server object, it simply drops the connection.
94 A WebServer object is responsible for bandwidth management.
96 A Server object may not send data until it is told to by its parent (WebServer)
97 object. A Server object sends a readyToWrite(this) signal when it has data to
98 send.
100 A WebServer object will call Server::write(number of bytes) when it wishes
101 to allow a Server to send data.
103 Connection limiting:
105 A WebServer object is responsible for connection limiting. When there are
106 `too many' Server objects, it will simply queue up incoming connections
107 until its backlog is too long, at which point it will simply ignore further
108 incoming connections.