Lines Matching refs:connect

215 static int tcp_recvpage_tls(struct connection *connect,
225 if (!connect) {
226 hmdfs_err("tcp connect == NULL");
229 node = connect->node;
230 tcp = (struct tcp_handle *)(connect->connect_handle);
393 static int tcp_recvbuffer_cipher(struct connection *connect,
404 tcp = (struct tcp_handle *)(connect->connect_handle);
430 ret = aeadcipher_decrypt_buffer(connect, cipherbuffer, cipherbuffer_len,
437 if (connect_recv_callback[connect->status]) {
438 connect_recv_callback[connect->status](connect, recv, outdata,
442 hmdfs_err("encypt callback NULL status %d", connect->status);
452 static int tcp_recvbuffer_tls(struct connection *connect,
461 tcp = (struct tcp_handle *)(connect->connect_handle);
481 tcp->connect->stat.recv_bytes += outlen;
483 if (connect_recv_callback[connect->status]) {
484 connect_recv_callback[connect->status](connect, recv, outdata,
488 hmdfs_err("callback NULL status %d", connect->status);
519 tcp->connect->stat.recv_bytes += sizeof(struct hmdfs_head_cmd);
520 tcp->connect->stat.recv_message_count++;
536 if (tcp->connect->status == CONNECT_STAT_WORKING &&
539 ret = tcp_recvpage_tls(tcp->connect, recv);
543 if (tcp->connect->status == CONNECT_STAT_WORKING)
544 ret = tcp_recvbuffer_tls(tcp->connect, recv);
546 ret = tcp_recvbuffer_cipher(tcp->connect, recv);
603 old_cred = hmdfs_override_creds(tcp->connect->node->sbi->system_cred);
612 list_empty(&tcp->connect->list))
629 hmdfs_node_inc_evt_seq(tcp->connect->node);
630 tcp->connect->status = CONNECT_STAT_STOP;
631 if (tcp->connect->node->status != NODE_STAT_OFFLINE)
632 hmdfs_reget_connection(tcp->connect);
642 connection_put(tcp->connect);
674 ret = aeadcipher_encrypt_buffer(tcp->connect, msg->data, msg->len,
743 tcp->connect->stat.send_bytes += send_len;
746 tcp->connect->stat.send_bytes += send_len;
747 tcp->connect->stat.send_message_count++;
752 int tcp_send_rekey_request(struct connection *connect)
756 struct tcp_handle *tcp = connect->connect_handle;
796 static int tcp_send_message(struct connection *connect,
805 if (!connect) {
817 tcp = (struct tcp_handle *)(connect->connect_handle);
818 if (connect->status == CONNECT_STAT_STOP)
823 if (connect->status == CONNECT_STAT_WORKING)
833 if (nowtime - connect->stat.rekey_time >= REKEY_LIFETIME &&
834 connect->status == CONNECT_STAT_WORKING) {
836 connect->node->device_id);
837 ret = tcp_send_rekey_request(connect);
839 set_crypto_info(connect, SET_CRYPTO_SEND);
840 connect->stat.rekey_time = nowtime;
854 /* recv_task killed before sched, we need to put the connect */
856 connection_put(tcp->connect);
960 memcpy(tcp->connect->master_key, master_key, HMDFS_KEY_SIZE);
961 memcpy(tcp->connect->send_key, master_key, HMDFS_KEY_SIZE);
962 memcpy(tcp->connect->recv_key, master_key, HMDFS_KEY_SIZE);
963 tcp->connect->tfm = crypto_alloc_aead("gcm(aes)", 0, 0);
964 if (IS_ERR(tcp->connect->tfm)) {
965 err = PTR_ERR(tcp->connect->tfm);
966 tcp->connect->tfm = NULL;
971 err = set_tfm(master_key, tcp->connect->tfm);
977 connection_get(tcp->connect);
979 node = tcp->connect->node;
993 connection_put(tcp->connect);
995 crypto_free_aead(tcp->connect->tfm);
996 tcp->connect->tfm = NULL;
1007 static struct tcp_handle *tcp_alloc_handle(struct connection *connect,
1015 tcp->connect = connect;
1016 tcp->connect->connect_handle = (void *)tcp;
1250 void tcp_stop_connect(struct connection *connect)