Lines Matching refs:user_data
95 static void user_data_init(struct user_data_st *user_data, SSL *con, char *buf,
97 static int user_data_add(struct user_data_st *user_data, size_t i);
98 static int user_data_process(struct user_data_st *user_data, size_t *len,
100 static int user_data_has_data(struct user_data_st *user_data);
961 struct user_data_st user_data; in s_client_main() local
2905 user_data_init(&user_data, con, cbuf, BUFSIZZ, cmdmode); in s_client_main()
2955 switch (user_data_process(&user_data, &cbuf_len, &cbuf_off)) { in s_client_main()
2975 && user_data_has_data(&user_data)); in s_client_main()
3277 if (i > 0 && !user_data_add(&user_data, i)) { in s_client_main()
3792 static void user_data_init(struct user_data_st *user_data, SSL *con, char *buf, in user_data_init() argument
3795 user_data->con = con; in user_data_init()
3796 user_data->buf = buf; in user_data_init()
3797 user_data->bufmax = bufmax; in user_data_init()
3798 user_data->buflen = 0; in user_data_init()
3799 user_data->bufoff = 0; in user_data_init()
3800 user_data->mode = mode; in user_data_init()
3801 user_data->isfin = 0; in user_data_init()
3804 static int user_data_add(struct user_data_st *user_data, size_t i) in user_data_add() argument
3806 if (user_data->buflen != 0 || i > user_data->bufmax) in user_data_add()
3809 user_data->buflen = i; in user_data_add()
3810 user_data->bufoff = 0; in user_data_add()
3822 static int user_data_execute(struct user_data_st *user_data, int cmd, char *arg) in user_data_execute() argument
3834 if (SSL_is_quic(user_data->con)) { in user_data_execute()
3836 } else if(SSL_version(user_data->con) == TLS1_3_VERSION) { in user_data_execute()
3853 do_ssl_shutdown(user_data->con); in user_data_execute()
3854 SSL_set_connect_state(user_data->con); in user_data_execute()
3855 BIO_closesocket(SSL_get_fd(user_data->con)); in user_data_execute()
3860 if (!SSL_renegotiate(user_data->con)) in user_data_execute()
3874 if (!SSL_key_update(user_data->con, updatetype)) in user_data_execute()
3880 if (!SSL_stream_conclude(user_data->con, 0)) in user_data_execute()
3882 user_data->isfin = 1; in user_data_execute()
3895 static int user_data_process(struct user_data_st *user_data, size_t *len, in user_data_process() argument
3898 char *buf_start = user_data->buf + user_data->bufoff; in user_data_process()
3899 size_t outlen = user_data->buflen; in user_data_process()
3901 if (user_data->buflen == 0) { in user_data_process()
3907 if (user_data->mode == USER_DATA_MODE_BASIC) { in user_data_process()
3910 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
3911 return user_data_execute(user_data, USER_COMMAND_QUIT, NULL); in user_data_process()
3914 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
3915 return user_data_execute(user_data, USER_COMMAND_RECONNECT, NULL); in user_data_process()
3918 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
3919 return user_data_execute(user_data, USER_COMMAND_RENEGOTIATE, NULL); in user_data_process()
3923 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
3924 return user_data_execute(user_data, USER_COMMAND_KEY_UPDATE, in user_data_process()
3929 } else if (user_data->mode == USER_DATA_MODE_ADVANCED) { in user_data_process()
3939 user_data->bufoff++; in user_data_process()
3940 user_data->buflen--; in user_data_process()
3960 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
3982 } else if(SSL_is_quic(user_data->con)) { in user_data_process()
3985 } if (SSL_version(user_data->con) == TLS1_3_VERSION) { in user_data_process()
4000 ret = user_data_execute(user_data, cmd, arg_start); in user_data_process()
4007 oldoff = user_data->bufoff; in user_data_process()
4008 user_data->bufoff = (cmd_end - user_data->buf) + 1; in user_data_process()
4009 user_data->buflen -= user_data->bufoff - oldoff; in user_data_process()
4010 if (user_data->buf + 1 == cmd_start in user_data_process()
4011 && user_data->buflen == 1 in user_data_process()
4012 && user_data->buf[user_data->bufoff] == '\n') { in user_data_process()
4017 user_data->bufoff = 0; in user_data_process()
4018 user_data->buflen = 0; in user_data_process()
4032 if (user_data->isfin) { in user_data_process()
4033 user_data->buflen = user_data->bufoff = *len = *off = 0; in user_data_process()
4041 *off = user_data->bufoff; in user_data_process()
4042 user_data->buflen -= outlen; in user_data_process()
4043 if (user_data->buflen == 0) in user_data_process()
4044 user_data->bufoff = 0; in user_data_process()
4046 user_data->bufoff += outlen; in user_data_process()
4050 static int user_data_has_data(struct user_data_st *user_data) in user_data_has_data() argument
4052 return user_data->buflen > 0; in user_data_has_data()