Gnutonic Specifications
Note that this document is split into "Client" and "Server" functionality, and that the first two sections are solely Client-oriented.
Current Work (Note: gennyProtocol.java is the only file with real work on it so far)
- Read/Act Upon Config
- Options
- Speed -- What kind of connection do I have?
- Sort Order -- How should results be displayed?
- Min Connections -- How many hosts should we attempt to stay in touch with, minimum?
- Max Connections -- How many hosts are too many?
- Download Path -- Where should downloaded files go?
- Share Path(s) -- What directories do you want to share?
- Scan directory, generate array of filenames
- Assign each filename an identifier -- source
- Transfer Log -- Where should transfers be logged to?
- Get Hosts -- Should we ask a server for a list of hosts, or use a pre-existing one?
- Hosts Log -- Where should we log discovered hosts?
- Max Uploads -- How many outbound connections do I allow at once?
- Automatic Re-retrieve -- If a file's checksum computes improperly, should I automatically restart the download?
- Load GUI (only some clients)
- Connect
- Server Request
- Read in list of available servers
- Open socket on appropriate port
- Send request packet to each server
- Listen for responses
- Load responses into memory
- Close port, if different from main port
- Broadcast Existence()
- Read from config
- Broadcast Existence()
- Broadcast Existence
Client:
- Open appropriate port, if not already open
- Send series of broadcast packets (Control Foos) to segments of network
- Listen for responses (Control Bars); (creates netHost objects)
- Update Hosts
Server:
- Get open port from Client section
- Listen for Control Foos
- Send Control Bars
NOTE: Once per (minute? 5 mins? etc?), Info Pongs will be sent out to keep the host list accurate.
- File Info Service
Sever:
- Determine whether files are share
- If shared:
- Prepare File Response packet info (detailed below)
- Listen for/respond to File Requests
Client:
- Send File Requests (i.e tell me about your file service) to all hosts which have responded with a Control Bar or Info Pong
- Listen for File Responses. These will include:
- Where am I?
- How many files do I have?
- How big are those files?
- Update statistics from File Responses
- Index Service
Server:
- Listen for Index Requests
- Send Index Responses
- Unpack regex from Index Request
- Compare regex against array of available files (from config)
- Prepare Index Response packet (creates searchMatch objects) from matches. Includes:
- What are the matched files/IDs?
- How fast am I?
- Where am I?
- Am I over my upload quota? If so:
- If this is request #1 over quota, create array of queued hosts & their place in line, starting with this one
- If this is not request #1, add this host to the array
- Report back host's place in queue
- Send packet
Client:
- Upon receiving search request from user, prepare Index Request, which includes:
- Regex to search with
- Where am I?
- Listen for Index Responses
- Unpack Index Responses & report back to user
- File Fetch Service
Server:
- Listen for File Fetch Requests. These will include:
- File identifier
- Where am I?
- Port for data transfer
- Send File Fetch Responses. These will repeat data from File Fetch Request for confirmation.
- Listen for File GoAhead Responses. These will simply be "OK" or "No".
- If OK is received, open connection & begin sending file. Must be done over TCP/IP to ensure file integrity.
- Upon file completion, send File Done packet. This will be "identifier\checksum\Done".
- Listen for File Done OK packets. These will be "Got" if checksum computes, or "Bad" if it does not.
- Upon receiving "Got", drop connection
- Upon receiving "Bad", listen for File Resend packets
- If received, send File Fetch Response
- Listen for File GoAhead Response. If received, re-send file
- If not received within 30 seconds, drop connection
Client:
- Receive file request from user
- Send File Fetch Request
- Listen for File Fetch Responses
- Send File GoAhead Responses
- Accept incoming connection
- Download file
- Check for File Done packets
- Upon File Done packet receipt, compute checksum
- If checksum is good, send File Done OK "Got" packet & drop connection
- If checksum is bad, look in config for Auto Re-retrieve flag
- If yes, send File Resend packet
- Listen for File Fetch Response
- If received, send File GoAhead Response
- Accept incoming connection
- If no, drop connection
- Report to user status of file transfer at these points:
- Connection queued
- Connection started
- Download completed OK
- Download did not complete OK
- Restarting
- Done