X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Fprotocol.h;h=215d35b10ad261f386822d6dfe5591a1bb408d23;hb=109540caa4e37a3663b3dcfb9a205b9609e3f561;hp=2900ec48032870f5d7a1a1b3fb30409f05526ec2;hpb=3ab887b9bc819a846c75dd7f2ee5d41fac22b19f;p=debian%2Famanda diff --git a/common-src/protocol.h b/common-src/protocol.h index 2900ec4..215d35b 100644 --- a/common-src/protocol.h +++ b/common-src/protocol.h @@ -24,74 +24,22 @@ * file named AUTHORS, in the root directory of this distribution. */ /* - * $Id: protocol.h,v 1.8.10.3 2004/04/29 20:47:40 martinea Exp $ + * $Id: protocol.h,v 1.11 2006/05/25 01:47:12 johnfranks Exp $ * - * interfaces for amanda protocol + * server-side interfaces for amanda protocol state machine */ #ifndef PROTOCOL_H #define PROTOCOL_H -#include "amanda.h" -#include "dgram.h" +#include "security.h" -typedef enum { - S_BOGUS, - S_STARTUP, S_SENDREQ, S_ACKWAIT, S_REPWAIT, S_SUCCEEDED, S_FAILED -} pstate_t; - -typedef enum { A_BOGUS, A_START, A_TIMEOUT, A_RCVDATA } action_t; - -typedef enum { P_BOGUS, P_REQ, P_REP, P_ACK, P_NAK } pktype_t; - -typedef struct { /* a predigested datagram */ - pktype_t type; - struct sockaddr_in peer; - uint32_t cksum; - int version_major, version_minor; - int sequence; - char *handle; - char *service; - char *security; - char *body; - dgram_t dgram; -} pkt_t; - -typedef struct proto_s { - pstate_t state; - pstate_t prevstate; - struct sockaddr_in peer; - time_t timeout; - time_t repwait; - time_t origtime, curtime; - int reqtries, acktries; - int origseq, curseq; - int handleofs; - char *security; - uint32_t auth_cksum; - char *req; /* body of request msg */ - void (*continuation) P((struct proto_s *, pkt_t *)); - void *datap; - struct proto_s *prev,*next; -} proto_t; - -void proto_init P((int sock, int startseq, int handles)); -int make_request P((char *hostname, int port, char *req, void *datap, - time_t repwait, - void (*continuation) P((proto_t *p, pkt_t *pkt)) - )); - -void check_protocol P((void)); -void run_protocol P((void)); - -void parse_pkt_header P((pkt_t *pkt)); - -#ifdef KRB4_SECURITY -int make_krb_request P((char *hostname, int port, char *req, - void *datap, time_t repwait, - void (*continuation) P((proto_t *p, pkt_t *pkt)) - )); -#endif - -extern char *parse_errmsg; +void protocol_init(void); +typedef void (*protocol_sendreq_callback)(void *, pkt_t *, + security_handle_t *); +void protocol_sendreq(const char *, const security_driver_t *, + char *(*)(char *, void *), const char *, time_t, + protocol_sendreq_callback, void *); +void protocol_check(void); +void protocol_run(void); #endif /* PROTOCOL_H */