Lines Matching refs:state
15 /* void tlsp_state_free(state)
16 /* TLSP_STATE *state;
103 /* tlsp_state_create - create TLS proxy state object */
108 TLSP_STATE *state = (TLSP_STATE *) mymalloc(sizeof(*state));
110 state->flags = TLSP_FLAG_DO_HANDSHAKE;
111 state->service = mystrdup(service);
112 state->plaintext_stream = plaintext_stream;
113 state->plaintext_buf = 0;
114 state->ciphertext_fd = -1;
115 state->ciphertext_timer = 0;
116 state->timeout = -1;
117 state->remote_endpt = 0;
118 state->server_id = 0;
119 state->tls_context = 0;
120 state->tls_params = 0;
121 state->server_init_props = 0;
122 state->server_start_props = 0;
123 state->client_init_props = 0;
124 state->client_start_props = 0;
126 return (state);
129 /* tlsp_state_free - destroy state objects, connection and events */
131 void tlsp_state_free(TLSP_STATE *state)
134 if (state->remote_endpt && state->server_id
135 && (state->flags & TLSP_FLAG_DO_HANDSHAKE))
137 state->server_id, state->remote_endpt);
138 myfree(state->service);
139 if (state->plaintext_buf) /* turns off plaintext events */
140 nbbio_free(state->plaintext_buf);
142 event_disable_readwrite(vstream_fileno(state->plaintext_stream));
143 event_server_disconnect(state->plaintext_stream);
144 if (state->ciphertext_fd >= 0) {
145 event_disable_readwrite(state->ciphertext_fd);
146 (void) close(state->ciphertext_fd);
148 if (state->ciphertext_timer)
149 event_cancel_timer(state->ciphertext_timer, (void *) state);
150 if (state->remote_endpt) {
151 msg_info("DISCONNECT %s", state->remote_endpt);
152 myfree(state->remote_endpt);
154 if (state->server_id)
155 myfree(state->server_id);
156 if (state->tls_context)
157 tls_free_context(state->tls_context);
158 if (state->tls_params)
159 tls_proxy_client_param_free(state->tls_params);
160 if (state->server_init_props)
161 tls_proxy_server_init_free(state->server_init_props);
162 if (state->server_start_props)
163 tls_proxy_server_start_free(state->server_start_props);
164 if (state->client_init_props)
165 tls_proxy_client_init_free(state->client_init_props);
166 if (state->client_start_props)
167 tls_proxy_client_start_free(state->client_start_props);
168 myfree((void *) state);