X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Fprotocol.h;h=228382aadfdb957a3a1780add5872593451b0cdd;hb=HEAD;hp=6fd886bcd0c6496414830ca84f17ca4ce2752307;hpb=0de2ad0a86685398621fb8ffa6990c029681bb3a;p=debian%2Famanda diff --git a/common-src/protocol.h b/common-src/protocol.h index 6fd886b..228382a 100644 --- a/common-src/protocol.h +++ b/common-src/protocol.h @@ -1,6 +1,7 @@ /* * Amanda, The Advanced Maryland Automatic Network Disk Archiver * Copyright (c) 1991-1998 University of Maryland at College Park + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -24,74 +25,22 @@ * file named AUTHORS, in the root directory of this distribution. */ /* - * $Id: protocol.h,v 1.8.10.2.2.2 2004/04/29 20:47:22 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_PREP, 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 */