#ifndef SERVICE_H
#define SERVICE_H
#include "../public/nsapi.h"
#include "../util/systems.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AIO_BUF_SIZE 16384
typedef struct HttpRange HttpRange;
struct HttpRange {
off_t begin;
off_t end;
HttpRange *next;
};
typedef struct AsyncSendRange {
Session *sn;
Request *rq;
SYS_FILE in;
SYS_NETFD out;
off_t offset;
off_t end;
off_t pos;
char *header;
int headerlen;
size_t headerpos;
Event *readev;
Event *writeev;
aiocb_s *aio;
size_t wpos;
WSBool read_complete;
WSBool read_inprogress;
WSBool write_inprogress;
WSBool error;
} AsyncSendRange;
int send_file(pblock *pb, Session *sn, Request *rq);
int service_hello(pblock *pb, Session *sn, Request *rq);
int service_ws_hello(pblock *pb, Session *sn, Request *rq);
int service_index(pblock *pb, Session *sn, Request *rq);
int send_options(pblock *pb, Session *sn, Request *rq);
#ifdef __cplusplus
}
#endif
#endif