-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPROJ2_HOWTO
More file actions
59 lines (38 loc) · 1.78 KB
/
Copy pathPROJ2_HOWTO
File metadata and controls
59 lines (38 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SPIFFY ROUTER
-------------
The Spiffy Router (tm) emulates limited bandwidth links between your nodes.
To use it, you must do two things:
a) call spiffy_sendto and spiffy_recvfrom in your code
instead of recvfrom and sendto
b) setenv SPIFFY_ROUTER ipadress:port
before you run your program
If you don't want to use the spiffy router, just don't set the environment
variable, and the packets will be sent out normally. An example spiffy router
setting:
setenv SPIFFY_ROUTER 127.0.0.1:32232
(localhost, port 32232). Please run the spiffy router on a port in your group's
range to ensure that you don't bump into someone else's programs!
DEBUGGING SUPPORT
-----------------
For your debugging use, we've provided a basic debug library in debug.{c,h}. To use
the debugging macros, start your program with
peer -d <##>
where ## specifies the debugging bits you'd like to have enabled. Use
peer -d list
to get a list of debug flags. See debug.h to add your own flags.
If you rewrite the command line parsing code but want to keep the debugging facility,
see the initialization code in bt_parse.c to see how you initialize the debug code.
It's very simple.
INPUT BUFFER
------------
We've supplied some input buffering code to handle the terminal input
from the user. It should just work. Let us know if you encounter
any problems with it.
MANAGING CHUNKS
---------------
We've provided the make-chunks program to create chunk hashes from an input
file. The chunk hashes are 40 byte ascii representation of SHA hash. You can
run 'make-chunks <input-file>' to get the chunk hashes of a file.
You can use the 'ascii2hex' function in chunk.c to convert ascii hashes into
binary chunk hash of 20 bytes.
To generate hash of a chunk, you should use 'shahash' function in chunk.c.