summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-08-29 12:58:39 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-08-29 12:58:39 +0000
commit5cb018a2c17e92dfb50e5bc1c03ccc080f6be87b (patch)
tree61f4f6ab841f1656b6c46205cc063befdaac7dc8 /doc
parent38c90cd3ff90327d5767b192be1a940ca22af406 (diff)
downloadgnutls-5cb018a2c17e92dfb50e5bc1c03ccc080f6be87b.tar.gz
Renamed all the constructed types to have more consisten names, and some other minor improvements.
Diffstat (limited to 'doc')
-rw-r--r--doc/tex/ex1.tex58
-rw-r--r--doc/tex/ex2.tex38
-rw-r--r--doc/tex/ex3.tex36
-rw-r--r--doc/tex/ex4.tex44
-rw-r--r--doc/tex/examples.tex2
-rw-r--r--doc/tex/serv1.tex76
-rw-r--r--doc/tex/srp1.tex8
7 files changed, 131 insertions, 131 deletions
diff --git a/doc/tex/ex1.tex b/doc/tex/ex1.tex
index faf2efe160..966831edf2 100644
--- a/doc/tex/ex1.tex
+++ b/doc/tex/ex1.tex
@@ -27,14 +27,14 @@ int main()
int err, ret;
int sd, ii, alert;
struct sockaddr_in sa;
- GNUTLS_STATE state;
+ gnutls_session session;
char buffer[MAX_BUF + 1];
- GNUTLS_CERTIFICATE_CLIENT_CREDENTIALS xcred;
+ gnutls_certificate_client_credentials xcred;
/* variables used in session resuming */
int t;
- char *session;
+ char *session_data;
char *session_id;
- int session_size;
+ int session_data_size;
int session_id_size;
char *tmp_session_id;
int tmp_session_id_size;
@@ -63,26 +63,26 @@ int main()
fprintf(stderr, "Connect error");
exit(1);
}
- gnutls_init(&state, GNUTLS_CLIENT);
+ gnutls_session_init(&session, GNUTLS_CLIENT);
- gnutls_protocol_set_priority(state, protocol_priority);
- gnutls_cipher_set_priority(state, cipher_priority);
- gnutls_compression_set_priority(state, comp_priority);
- gnutls_kx_set_priority(state, kx_priority);
- gnutls_mac_set_priority(state, mac_priority);
+ gnutls_protocol_set_priority(session, protocol_priority);
+ gnutls_cipher_set_priority(session, cipher_priority);
+ gnutls_compression_set_priority(session, comp_priority);
+ gnutls_kx_set_priority(session, kx_priority);
+ gnutls_mac_set_priority(session, mac_priority);
- gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred);
+ gnutls_cred_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
if (t > 0) { /* if this is not the first time we connect */
- gnutls_session_set_data(state, session, session_size);
- free(session);
+ gnutls_session_set_data(session, session_data, session_data_size);
+ free(session_data);
}
- gnutls_transport_set_ptr( state, sd);
+ gnutls_transport_set_ptr( session, sd);
/* Perform the TLS handshake
*/
- ret = gnutls_handshake( state);
+ ret = gnutls_handshake( session);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
@@ -94,26 +94,26 @@ int main()
if (t == 0) { /* the first time we connect */
/* get the session data size */
- gnutls_session_get_data(state, NULL, &session_size);
- session = malloc(session_size);
+ gnutls_session_get_data(session, NULL, &session_data_size);
+ session_data = malloc(session_data_size);
/* put session data to the session variable */
- gnutls_session_get_data(state, session, &session_size);
+ gnutls_session_get_data(session, session_data, &session_data_size);
/* keep the current session ID. This is only needed
* in order to check if the server actually resumed this
* connection.
*/
- gnutls_session_get_id(state, NULL, &session_id_size);
+ gnutls_session_get_id(session, NULL, &session_id_size);
session_id = malloc(session_id_size);
- gnutls_session_get_id(state, session_id, &session_id_size);
+ gnutls_session_get_id(session, session_id, &session_id_size);
} else { /* the second time we connect */
/* check if we actually resumed the previous session */
- gnutls_session_get_id(state, NULL, &tmp_session_id_size);
+ gnutls_session_get_id(session, NULL, &tmp_session_id_size);
tmp_session_id = malloc(tmp_session_id_size);
- gnutls_session_get_id(state, tmp_session_id, &tmp_session_id_size);
+ gnutls_session_get_id(session, tmp_session_id, &tmp_session_id_size);
if (memcmp(tmp_session_id, session_id, session_id_size) == 0) {
printf("- Previous session was resumed\n");
@@ -126,11 +126,11 @@ int main()
/* This function was defined in a previous example
*/
- print_info(state);
+ print_info(session);
- gnutls_record_send( state, MSG, strlen(MSG));
+ gnutls_record_send( session, MSG, strlen(MSG));
- ret = gnutls_record_recv( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( session, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
@@ -142,11 +142,11 @@ int main()
}
} else {
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED)
- alert = gnutls_alert_get(state);
+ alert = gnutls_alert_get(session);
printf("* Received alert [%d]: %s\n", alert, gnutls_alert_get_name(alert));
if (ret == GNUTLS_E_REHANDSHAKE) {
printf("* Received HelloRequest message (server asked to rehandshake)\n");
- gnutls_alert_send_appropriate( state, ret); /* we don't want rehandshake */
+ gnutls_alert_send_appropriate( session, ret); /* we don't want rehandshake */
}
}
@@ -157,14 +157,14 @@ int main()
}
fputs("\n", stdout);
}
- gnutls_bye( state, GNUTLS_SHUT_RDWR);
+ gnutls_bye( session, GNUTLS_SHUT_RDWR);
end:
shutdown(sd, SHUT_RDWR); /* no more receptions */
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(session);
} /* for() */
diff --git a/doc/tex/ex2.tex b/doc/tex/ex2.tex
index 0e92c83bdb..90f484b7c0 100644
--- a/doc/tex/ex2.tex
+++ b/doc/tex/ex2.tex
@@ -21,9 +21,9 @@ int main()
int err, ret;
int sd, ii;
struct sockaddr_in sa;
- GNUTLS_STATE state;
+ gnutls_session session;
char buffer[MAX_BUF + 1];
- GNUTLS_CERTIFICATE_CLIENT_CREDENTIALS xcred;
+ gnutls_certificate_client_credentials xcred;
const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
const int kx_priority[] = { GNUTLS_KX_RSA, 0 };
const int cipher_priority[] = { GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_ARCFOUR\_128, 0};
@@ -58,41 +58,41 @@ int main()
fprintf(stderr, "Connect error\n");
exit(1);
}
- /* Initialize TLS state
+ /* Initialize TLS session
*/
- gnutls_init(&state, GNUTLS_CLIENT);
+ gnutls_session_init(&session, GNUTLS_CLIENT);
/* allow both SSL3 and TLS1
*/
- gnutls_protocol_set_priority(state, protocol_priority);
+ gnutls_protocol_set_priority(session, protocol_priority);
/* allow only ARCFOUR and 3DES ciphers
* (3DES has the highest priority)
*/
- gnutls_cipher_set_priority(state, cipher_priority);
+ gnutls_cipher_set_priority(session, cipher_priority);
/* only allow null compression
*/
- gnutls_compression_set_priority(state, comp_priority);
+ gnutls_compression_set_priority(session, comp_priority);
/* use GNUTLS_KX_RSA
*/
- gnutls_kx_set_priority(state, kx_priority);
+ gnutls_kx_set_priority(session, kx_priority);
/* allow the usage of both SHA and MD5
*/
- gnutls_mac_set_priority(state, mac_priority);
+ gnutls_mac_set_priority(session, mac_priority);
- /* put the x509 credentials to the current state
+ /* put the x509 credentials to the current session
*/
- gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred);
+ gnutls_cred_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
- gnutls_transport_set_ptr( state, sd);
+ gnutls_transport_set_ptr( session, sd);
/* Perform the TLS handshake
*/
- ret = gnutls_handshake( state);
+ ret = gnutls_handshake( session);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
@@ -102,9 +102,9 @@ int main()
printf("- Handshake was completed\n");
}
- gnutls_record_send( state, MSG, strlen(MSG));
+ gnutls_record_send( session, MSG, strlen(MSG));
- ret = gnutls_record_recv( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( session, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
@@ -116,10 +116,10 @@ int main()
}
} else {
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED)
- printf("* Received alert [%d]\n", gnutls_alert_get(state));
+ printf("* Received alert [%d]\n", gnutls_alert_get(session));
if (ret == GNUTLS_E_REHANDSHAKE)
printf("* Received HelloRequest message (server asked to rehandshake)\n");
- gnutls_alert_send_appropriate( state, ret); /* we don't want rehandshake */
+ gnutls_alert_send_appropriate( session, ret); /* we don't want rehandshake */
}
if (ret > 0) {
@@ -129,14 +129,14 @@ int main()
}
fputs("\n", stdout);
}
- gnutls_bye( state, GNUTLS_SHUT_RDWR);
+ gnutls_bye( session, GNUTLS_SHUT_RDWR);
end:
shutdown(sd, SHUT_RDWR); /* no more receptions */
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(session);
gnutls_certificate_free_client_cred(xcred);
diff --git a/doc/tex/ex3.tex b/doc/tex/ex3.tex
index 63c9bdf657..85dfe7afa6 100644
--- a/doc/tex/ex3.tex
+++ b/doc/tex/ex3.tex
@@ -10,37 +10,37 @@
PRINTX( "E:", X.email)
/* This function will print some details of the
- * given state.
+ * given session.
*/
-int print_info(GNUTLS_STATE state)
+int print_info(gnutls_session session)
{
const char *tmp;
- GNUTLS_CredType cred;
+ gnutls_credentials_type cred;
gnutls_x509_dn dn;
const gnutls_datum *cert_list;
int status;
int cert_list_size = 0;
- GNUTLS_KXAlgorithm kx;
- time_t expiret = gnutls_certificate_expiration_time_peers(state);
- time_t activet = gnutls_certificate_activation_time_peers(state);
+ gnutls_kx_algorithm kx;
+ time_t expiret = gnutls_certificate_expiration_time_peers(session);
+ time_t activet = gnutls_certificate_activation_time_peers(session);
/* print the key exchange's algorithm name
*/
- kx = gnutls_kx_get(state);
+ kx = gnutls_kx_get(session);
tmp = gnutls_kx_get_name(kx);
printf("- Key Exchange: %s\n", tmp);
- cred = gnutls_auth_get_type(state);
+ cred = gnutls_auth_get_type(session);
switch (cred) {
case GNUTLS_CRD_ANON:
printf("- Anonymous DH using prime of %d bits\n",
- gnutls_dh_get_bits(state));
+ gnutls_dh_get_bits(session));
break;
case GNUTLS_CRD_CERTIFICATE:
/* in case of certificate authentication
*/
- cert_list = gnutls_certificate_get_peers(state, &cert_list_size);
- status = gnutls_certificate_verify_peers(state);
+ cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
+ status = gnutls_certificate_verify_peers(session);
if ( status < 0) {
if ( status == GNUTLS_E_NO_CERTIFICATE_FOUND)
@@ -66,13 +66,13 @@ int print_info(GNUTLS_STATE state)
*/
if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS) {
printf("\n- Ephemeral DH using prime of %d bits\n",
- gnutls_dh_get_bits(state));
+ gnutls_dh_get_bits(session));
}
/* if the certificate list is available, then
* print some information about it.
*/
- if (cert_list_size > 0 && gnutls_cert_type_get(state) == GNUTLS_CRT_X509) {
+ if (cert_list_size > 0 && gnutls_cert_type_get(session) == GNUTLS_CRT_X509) {
char digest[20];
char serial[40];
int digest_size = sizeof(digest), i;
@@ -138,19 +138,19 @@ int print_info(GNUTLS_STATE state)
}
}
- tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(state));
+ tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(session));
printf("- Protocol: %s\n", tmp);
- tmp = gnutls_cert_type_get_name( gnutls_cert_type_get(state));
+ tmp = gnutls_cert_type_get_name( gnutls_cert_type_get(session));
printf("- Certificate Type: %s\n", tmp);
- tmp = gnutls_compression_get_name(gnutls_compression_get(state));
+ tmp = gnutls_compression_get_name(gnutls_compression_get(session));
printf("- Compression: %s\n", tmp);
- tmp = gnutls_cipher_get_name(gnutls_cipher_get(state));
+ tmp = gnutls_cipher_get_name(gnutls_cipher_get(session));
printf("- Cipher: %s\n", tmp);
- tmp = gnutls_mac_get_name(gnutls_mac_get(state));
+ tmp = gnutls_mac_get_name(gnutls_mac_get(session));
printf("- MAC: %s\n", tmp);
return 0;
diff --git a/doc/tex/ex4.tex b/doc/tex/ex4.tex
index a640483b1f..86ba098b5c 100644
--- a/doc/tex/ex4.tex
+++ b/doc/tex/ex4.tex
@@ -27,9 +27,9 @@ int main()
int err, ret;
int sd, ii, alert;
struct sockaddr_in sa;
- GNUTLS_STATE state;
+ gnutls_session session;
char buffer[MAX_BUF + 1];
- GNUTLS_CERTIFICATE_CLIENT_CREDENTIALS xcred;
+ gnutls_certificate_client_credentials xcred;
/* variables used in session resuming */
int t;
char *session;
@@ -59,26 +59,26 @@ int main()
fprintf(stderr, "Connect error");
exit(1);
}
- gnutls_init(&state, GNUTLS_CLIENT);
+ gnutls_session_init(&session, GNUTLS_CLIENT);
- gnutls_protocol_set_priority(state, protocol_priority);
- gnutls_cipher_set_priority(state, cipher_priority);
- gnutls_compression_set_priority(state, comp_priority);
- gnutls_kx_set_priority(state, kx_priority);
- gnutls_mac_set_priority(state, mac_priority);
+ gnutls_protocol_set_priority(session, protocol_priority);
+ gnutls_cipher_set_priority(session, cipher_priority);
+ gnutls_compression_set_priority(session, comp_priority);
+ gnutls_kx_set_priority(session, kx_priority);
+ gnutls_mac_set_priority(session, mac_priority);
- gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred);
+ gnutls_cred_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
if (t > 0) { /* if this is not the first time we connect */
- gnutls_session_set_data(state, session, session_size);
+ gnutls_session_set_data(session, session, session_size);
free(session);
}
- gnutls_transport_set_ptr( state, sd);
+ gnutls_transport_set_ptr( session, sd);
/* Perform the TLS handshake
*/
- ret = gnutls_handshake( state);
+ ret = gnutls_handshake( session);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
@@ -90,16 +90,16 @@ int main()
if (t == 0) { /* the first time we connect */
/* get the session data size */
- gnutls_session_get_data(state, NULL, &session_size);
+ gnutls_session_get_data(session, NULL, &session_size);
session = malloc(session_size);
/* put session data to the session variable */
- gnutls_session_get_data(state, session, &session_size);
+ gnutls_session_get_data(session, session, &session_size);
} else { /* the second time we connect */
/* check if we actually resumed the previous session */
- if (gnutls_session_is_resumed( state) != 0) {
+ if (gnutls_session_is_resumed( session) != 0) {
printf("- Previous session was resumed\n");
} else {
fprintf(stderr, "*** Previous session was NOT resumed\n");
@@ -108,11 +108,11 @@ int main()
/* This function was defined in a previous example
*/
- print_info(state);
+ print_info(session);
- gnutls_record_send( state, MSG, strlen(MSG));
+ gnutls_record_send( session, MSG, strlen(MSG));
- ret = gnutls_record_recv( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( session, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
@@ -124,11 +124,11 @@ int main()
}
} else {
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED)
- alert = gnutls_alert_get(state);
+ alert = gnutls_alert_get(session);
printf("* Received alert [%d]: %s\n", alert, gnutls_alert_get_name(alert));
if (ret == GNUTLS_E_REHANDSHAKE) {
printf("* Received HelloRequest message (server asked to rehandshake)\n");
- gnutls_alert_send_appropriate( state, ret); /* we don't want rehandshake */
+ gnutls_alert_send_appropriate( session, ret); /* we don't want rehandshake */
}
}
@@ -139,14 +139,14 @@ int main()
}
fputs("\n", stdout);
}
- gnutls_bye( state, GNUTLS_SHUT_RDWR);
+ gnutls_bye( session, GNUTLS_SHUT_RDWR);
end:
shutdown(sd, SHUT_RDWR); /* no more receptions */
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(session);
} /* for() */
diff --git a/doc/tex/examples.tex b/doc/tex/examples.tex
index 006da1463b..3877154aef 100644
--- a/doc/tex/examples.tex
+++ b/doc/tex/examples.tex
@@ -14,7 +14,7 @@ any other fancy features.
the result of the peer's certificate verification function. The lack of
this check may result to an unauthenticated connection.
The following function does check the peer's
-X.509 certificate, and prints some information about the current state.
+X.509 certificate, and prints some information about the current session.
\par
This function should be called after a successful
\printfunc{gnutls_handshake}{gnutls\_handshake}
diff --git a/doc/tex/serv1.tex b/doc/tex/serv1.tex
index a18b501e98..d0e4b0d6d2 100644
--- a/doc/tex/serv1.tex
+++ b/doc/tex/serv1.tex
@@ -32,12 +32,12 @@
#define DH_BITS 1024
/* These are global */
-GNUTLS_SRP_SERVER_CREDENTIALS srp_cred;
-GNUTLS_CERTIFICATE_SERVER_CREDENTIALS x509_cred;
+gnutls_srp_server_credentials srp_cred;
+gnutls_certificate_server_credentials x509_cred;
-GNUTLS_STATE initialize_state()
+gnutls_session initialize_session()
{
- GNUTLS_STATE state;
+ gnutls_session session;
int ret;
const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 };
const int kx_priority[] = { GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0 };
@@ -45,72 +45,72 @@ GNUTLS_STATE initialize_state()
const int comp_priority[] = { GNUTLS_COMP_ZLIB, GNUTLS_COMP_NULL, 0 };
const int mac_priority[] = { GNUTLS_MAC_SHA, GNUTLS_MAC_MD5, 0 };
- gnutls_init(&state, GNUTLS_SERVER);
+ gnutls_session_init(&session, GNUTLS_SERVER);
- gnutls_protocol_set_priority(state, protocol_priority);
- gnutls_cipher_set_priority(state, cipher_priority);
- gnutls_compression_set_priority(state, comp_priority);
- gnutls_kx_set_priority(state, kx_priority);
- gnutls_mac_set_priority(state, mac_priority);
+ gnutls_protocol_set_priority(session, protocol_priority);
+ gnutls_cipher_set_priority(session, cipher_priority);
+ gnutls_compression_set_priority(session, comp_priority);
+ gnutls_kx_set_priority(session, kx_priority);
+ gnutls_mac_set_priority(session, mac_priority);
- gnutls_cred_set(state, GNUTLS_CRD_SRP, srp_cred);
- gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, x509_cred);
+ gnutls_cred_set(session, GNUTLS_CRD_SRP, srp_cred);
+ gnutls_cred_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
/* request client certificate if any.
*/
- gnutls_certificate_server_set_request( state, GNUTLS_CERT_REQUEST);
+ gnutls_certificate_server_set_request( session, GNUTLS_CERT_REQUEST);
- gnutls_dh_set_prime_bits( state, DH_BITS);
+ gnutls_dh_set_prime_bits( session, DH_BITS);
/* some broken clients may require this in order to connect.
* This may weaken security though.
*/
- /* gnutls_handshake_set_rsa_pms_check( state, 1); */
+ /* gnutls_handshake_set_rsa_pms_check( session, 1); */
- return state;
+ return session;
}
-void print_info(GNUTLS_STATE state)
+void print_info(gnutls_session session)
{
const char *tmp;
unsigned char sesid[32];
int sesid_size, i;
/* print session_id specific data */
- gnutls_session_get_id(state, sesid, &sesid_size);
+ gnutls_session_get_id(session, sesid, &sesid_size);
printf("\n- Session ID: ");
for (i = 0; i < sesid_size; i++)
printf("%.2X", sesid[i]);
printf("\n");
/* print srp specific data */
- if (gnutls_auth_get_type(state) == GNUTLS_CRD_SRP) {
+ if (gnutls_auth_get_type(session) == GNUTLS_CRD_SRP) {
printf("\n- User '%s' connected\n",
- gnutls_srp_server_get_username( state));
+ gnutls_srp_server_get_username( session));
}
- /* print state information */
- tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(state));
+ /* print session information */
+ tmp = gnutls_protocol_get_name(gnutls_protocol_get_version(session));
printf("- Version: %s\n", tmp);
- tmp = gnutls_kx_get_name(gnutls_kx_get(state));
+ tmp = gnutls_kx_get_name(gnutls_kx_get(session));
printf("- Key Exchange: %s\n", tmp);
tmp =
gnutls_compression_get_name
- (gnutls_compression_get(state));
+ (gnutls_compression_get(session));
printf("- Compression: %s\n", tmp);
- tmp = gnutls_cipher_get_name(gnutls_cipher_get(state));
+ tmp = gnutls_cipher_get_name(gnutls_cipher_get(session));
printf("- Cipher: %s\n", tmp);
- tmp = gnutls_mac_get_name(gnutls_mac_get(state));
+ tmp = gnutls_mac_get_name(gnutls_mac_get(session));
printf("- MAC: %s\n", tmp);
}
-GNUTLS_DH_PARAMS dh_params;
+gnutls_dh_params dh_params;
static int generate_dh_primes(void) {
gnutls_datum prime, generator;
@@ -136,7 +136,7 @@ int main()
struct sockaddr_in sa_cli;
int client_len;
char topbuf[512];
- GNUTLS_STATE state;
+ gnutls_session session;
char buffer[MAX_BUF + 1];
int optval = 1;
int http = 0;
@@ -199,7 +199,7 @@ int main()
client_len = sizeof(sa_cli);
for (;;) {
- state = initialize_state();
+ session = initialize_session();
sd = accept(listen_sd, (SA *) & sa_cli, &client_len);
@@ -207,23 +207,23 @@ int main()
inet_ntop(AF_INET, &sa_cli.sin_addr, topbuf,
sizeof(topbuf)), ntohs(sa_cli.sin_port));
- gnutls_transport_set_ptr( state, sd);
- ret = gnutls_handshake( state);
+ gnutls_transport_set_ptr( session, sd);
+ ret = gnutls_handshake( session);
if (ret < 0) {
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(session);
fprintf(stderr, "*** Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
continue;
}
printf("- Handshake was completed\n");
- print_info(state);
+ print_info(session);
i = 0;
for (;;) {
bzero(buffer, MAX_BUF + 1);
- ret = gnutls_record_recv( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( session, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
@@ -241,21 +241,21 @@ int main()
if (ret > 0) {
/* echo data back to the client
*/
- gnutls_record_send( state, buffer,
+ gnutls_record_send( session, buffer,
strlen(buffer));
}
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
- ret = gnutls_alert_get(state);
+ ret = gnutls_alert_get(session);
printf("* Received alert '%d' - '%s'.\n", ret, gnutls_alert_get_name( ret));
}
}
printf("\n");
- gnutls_bye( state, 1); /* do not wait for
+ gnutls_bye( session, GNUTLS_SHUT_WR); /* do not wait for
* the peer to close the connection.
*/
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(session);
}
close(listen_sd);
diff --git a/doc/tex/srp1.tex b/doc/tex/srp1.tex
index 67c0b44166..e2094440de 100644
--- a/doc/tex/srp1.tex
+++ b/doc/tex/srp1.tex
@@ -28,9 +28,9 @@ int main()
int err, ret;
int sd, ii;
struct sockaddr_in sa;
- GNUTLS_STATE state;
+ gnutls_session state;
char buffer[MAX_BUF + 1];
- GNUTLS_SRP_CLIENT_CREDENTIALS xcred;
+ gnutls_srp_client_credentials xcred;
if (gnutls_global_init() < 0) {
fprintf(stderr, "global state initialization error\n");
@@ -66,7 +66,7 @@ int main()
}
/* Initialize TLS state
*/
- gnutls_init(&state, GNUTLS_CLIENT);
+ gnutls_session_init(&state, GNUTLS_CLIENT);
/* allow both SSL3 and TLS1
*/
@@ -141,7 +141,7 @@ int main()
shutdown(sd, SHUT_RDWR); /* no more receptions */
close(sd);
- gnutls_deinit(state);
+ gnutls_session_deinit(state);
gnutls_srp_free_client_cred(xcred);