author | Michael Krelin <hacker@klever.net> | 2012-12-08 21:19:17 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2012-12-11 21:59:29 (UTC) |
commit | 8808689fe340bec6e90ab13dd502292b0579cf1f (patch) (unidiff) | |
tree | 45b7c863151341f687b74e40bffcbd7ab5468783 /pumpkin/XFer.h | |
parent | 6e7e413ca364d79673e523c09767c18e7cff1bec (diff) | |
download | pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.zip pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.tar.gz pumpkin-8808689fe340bec6e90ab13dd502292b0579cf1f.tar.bz2 |
initial osx portosx/0.0
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | pumpkin/XFer.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/pumpkin/XFer.h b/pumpkin/XFer.h new file mode 100644 index 0000000..ffe7fc1 --- a/dev/null +++ b/pumpkin/XFer.h | |||
@@ -0,0 +1,68 @@ | |||
1 | |||
2 | #import <Foundation/Foundation.h> | ||
3 | #import "PumpKIN.h" | ||
4 | #include <netinet/in.h> | ||
5 | #import "TFTPPacket.h" | ||
6 | |||
7 | enum XFerState { | ||
8 | xferStateNone = 0, | ||
9 | xferStateConnecting, | ||
10 | xferStateXfer, | ||
11 | xferStateShutdown | ||
12 | }; | ||
13 | |||
14 | @interface XFer : NSObject { | ||
15 | struct sockaddr_in peer; | ||
16 | PumpKIN *pumpkin; | ||
17 | CFSocketRef sockie; | ||
18 | CFRunLoopSourceRef runloopSource; | ||
19 | NSFileHandle *theFile; | ||
20 | uint16_t blockSize; | ||
21 | uint16_t acked; | ||
22 | unsigned long long xferSize; | ||
23 | uint16_t xferBlocks; | ||
24 | enum XFerState state; | ||
25 | NSString *xferType; | ||
26 | NSString *xferFilename; | ||
27 | NSTimeInterval retryTimeout; | ||
28 | NSTimeInterval giveupTimeout; | ||
29 | TFTPPacket *lastPacket; | ||
30 | NSTimer *retryTimer; | ||
31 | NSTimer *giveupTimer; | ||
32 | TFTPPacket *initialPacket; | ||
33 | NSString *xferPrefix; | ||
34 | |||
35 | NSString *localFile; | ||
36 | |||
37 | NSMutableArray *queue; | ||
38 | } | ||
39 | @property (readonly) struct sockaddr_in *peer; | ||
40 | @property (readonly) TFTPPacket *initialPacket; | ||
41 | @property (readonly) NSString *xferFilename; | ||
42 | @property (readonly) NSString *localFile; | ||
43 | @property (readonly) NSString *xferPrefix; | ||
44 | |||
45 | - (id) init; | ||
46 | - (id) initWithPeer:(struct sockaddr_in *)sin andPacket:(TFTPPacket*)p; | ||
47 | |||
48 | - (BOOL) createSocket; | ||
49 | - (void) callbackWithType:(CFSocketCallBackType)t addr:(CFDataRef)a data:(const void *)d; | ||
50 | - (void) queuePacket:(TFTPPacket*)p; | ||
51 | |||
52 | - (void) eatTFTPPacket:(TFTPPacket*)p from:(struct sockaddr_in*)sin; | ||
53 | |||
54 | - (id) cellValueForColumn:(NSString*)ci; | ||
55 | |||
56 | - (void) updateView; | ||
57 | - (void) appear; | ||
58 | - (void) disappear; | ||
59 | |||
60 | - (BOOL) isPeer:(struct sockaddr_in*)sin; | ||
61 | |||
62 | - (void) abort; | ||
63 | |||
64 | - (void) goOnWithVerdict:(int)verdict; | ||
65 | |||
66 | - (BOOL) makeLocalFileName:(NSString*)xf; | ||
67 | |||
68 | @end | ||