2018-07-29 23:40:03 -05:00
|
|
|
#ifndef SESSION_H
|
|
|
|
#define SESSION_H
|
|
|
|
|
|
|
|
#include <types.h>
|
2018-08-11 01:53:53 -05:00
|
|
|
#include "twoimg.h"
|
2018-08-10 19:51:21 -05:00
|
|
|
|
2018-07-29 23:40:03 -05:00
|
|
|
typedef struct Session {
|
|
|
|
/* Marinetti TCP connection status */
|
|
|
|
Word ipid;
|
|
|
|
Boolean tcpLoggedIn;
|
|
|
|
|
|
|
|
/* ReadTCP status */
|
|
|
|
LongWord readCount;
|
|
|
|
Byte *readPtr;
|
|
|
|
|
|
|
|
/* Marinetti error codes, both the tcperr* value and any tool error */
|
|
|
|
Word tcperr;
|
|
|
|
Word toolerr;
|
|
|
|
|
|
|
|
/* HTTP request to send (if non-NULL, points to malloc'd buffer) */
|
|
|
|
char *httpRequest;
|
|
|
|
/* Pointer to the range part within httpRequest */
|
|
|
|
char *httpRequestRange;
|
2018-08-01 00:05:19 -05:00
|
|
|
/* Length of HTTP request */
|
|
|
|
LongWord httpRequestLen;
|
|
|
|
|
|
|
|
/* HTTP response code */
|
2018-08-01 01:37:22 -05:00
|
|
|
LongWord responseCode;
|
2018-07-29 23:40:03 -05:00
|
|
|
|
|
|
|
/* IP address and TCP port of host */
|
|
|
|
LongWord ipAddr;
|
|
|
|
Word port;
|
|
|
|
|
2018-07-30 21:35:45 -05:00
|
|
|
/* Domain name or IP address of host (p-string, but also null-terminated) */
|
|
|
|
char hostName[257];
|
2018-07-29 23:40:03 -05:00
|
|
|
/* Time (GetTick) of last DNS lookup */
|
|
|
|
LongWord dnsTime;
|
2018-08-01 00:05:19 -05:00
|
|
|
|
|
|
|
/* Number of redirects followed */
|
|
|
|
Word redirectCount;
|
|
|
|
|
|
|
|
/* Values reported by server in Content-Range header */
|
|
|
|
LongWord rangeStart, rangeEnd, totalLength;
|
|
|
|
/* Value reported by server in Content-Length header */
|
|
|
|
LongWord contentLength;
|
2018-08-01 01:37:22 -05:00
|
|
|
|
|
|
|
/* Desired start/end of range for next request */
|
|
|
|
LongWord desiredStart, desiredEnd;
|
|
|
|
/* Expected length of disk image */
|
|
|
|
LongWord expectedLength;
|
2018-08-10 17:53:09 -05:00
|
|
|
|
2018-08-10 19:51:21 -05:00
|
|
|
/* Offset of disk image blocks within file */
|
|
|
|
LongWord dataOffset;
|
2018-08-13 01:28:32 -05:00
|
|
|
/* Length of disk image data */
|
|
|
|
LongWord dataLength;
|
2018-08-10 19:51:21 -05:00
|
|
|
|
2018-08-10 17:53:09 -05:00
|
|
|
/* Buffer for initial bytes of file (which may be a disk image header) */
|
2018-08-10 19:51:21 -05:00
|
|
|
union {
|
|
|
|
unsigned char buf[32];
|
|
|
|
struct TwoImgHeader twoImgHeader;
|
|
|
|
} fileHeader;
|
2018-07-29 23:40:03 -05:00
|
|
|
} Session;
|
|
|
|
|
2018-08-10 22:40:07 -05:00
|
|
|
|
|
|
|
void EndNetDiskSession(Session *sess);
|
|
|
|
|
2018-07-29 23:40:03 -05:00
|
|
|
#endif
|