11 /* QMQPD_STATE *qmqpd_state_alloc(stream)
14 /* void qmqpd_state_free(state)
15 /* QMQPD_STATE *state;
17 /* qmqpd_state_alloc() creates and initializes session context.
19 /* qmqpd_state_free() destroys session context.
23 /* Stream connected to peer. The stream is not copied.
25 /* All errors are fatal.
29 /* The Secure Mailer license must be distributed with this software.
32 /* IBM T.J. Watson Research
34 /* Yorktown Heights, NY 10598, USA
42 /* Utility library. */
50 #include <mail_stream.h>
51 #include <cleanup_user.h>
52 #include <mail_proto.h>
54 /* Application-specific. */
58 /* qmqpd_state_alloc - allocate and initialize session state */
60 QMQPD_STATE
*qmqpd_state_alloc(VSTREAM
*stream
)
64 state
= (QMQPD_STATE
*) mymalloc(sizeof(*state
));
65 state
->err
= CLEANUP_STAT_OK
;
66 state
->client
= stream
;
67 state
->message
= vstring_alloc(1000);
68 state
->buf
= vstring_alloc(100);
69 GETTIMEOFDAY(&state
->arrival_time
);
70 qmqpd_peer_init(state
);
74 state
->rcpt_count
= 0;
78 state
->protocol
= MAIL_PROTO_QMQP
;
79 state
->where
= "initializing client connection";
80 state
->why_rejected
= vstring_alloc(10);
84 /* qmqpd_state_free - destroy session state */
86 void qmqpd_state_free(QMQPD_STATE
*state
)
88 vstring_free(state
->message
);
89 vstring_free(state
->buf
);
90 qmqpd_peer_reset(state
);
92 myfree(state
->queue_id
);
94 mail_stream_cleanup(state
->dest
);
96 myfree(state
->sender
);
98 myfree(state
->recipient
);
99 vstring_free(state
->why_rejected
);
100 myfree((char *) state
);