ex1.tex ex2.tex ex3.tex srp1.tex serv1.tex gnutls.css \
nx_grp_g.png prev_g.png up_g.png fdl.tex macros.tex \
cover.tex.in img1.png img3.png img5.png img2.png img4.png \
- img6.png gnutls-logo.ps layers.ps
+ img6.png img7.png gnutls-logo.ps layers.ps
TEX_OBJECTS = gnutls.tex ../../lib/gnutls-api.tex serv1.tex ex1.tex ex2.tex ex3.tex fdl.tex \
macros.tex cover.tex ciphersuites.tex resumedb.tex translayer.tex asn1.tex ../../lib/asn1-api.tex \
may warn about something (ie a warning alert was received), or
indicate the some action has to be taken. This is the case with
the error code GNUTLS\_E\_REHANDSHAKE returned by
-\hyperref{gnutls\_record\_read()}{gnutls\_record\_read() (see Section }{)}{gnutls_record_read}.
+\hyperref{gnutls\_record\_recv()}{gnutls\_record\_recv() (see Section }{)}{gnutls_record_recv}.
This error code indicates that the server requests a rehandshake. The client
may ignore this request, or may reply with an alert.
You can test if an error code is a fatal one by using the
*/
print_info(state);
- gnutls_record_write( state, MSG, strlen(MSG));
+ gnutls_record_send( state, MSG, strlen(MSG));
- ret = gnutls_record_read( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( state, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
printf("- Handshake was completed\n");
}
- gnutls_record_write( state, MSG, strlen(MSG));
+ gnutls_record_send( state, MSG, strlen(MSG));
- ret = gnutls_record_read( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( state, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
is to serve all other protocols and is above the transport layer.
The Record protocol offers symmetric encryption, and data authenticity.
In \gnutls{} the record protocol is accessed using the
-\hyperref{gnutls\_record\_read()}{gnutls\_record\_read() (see Section }{)}{gnutls_record_read} and
-\hyperref{gnutls\_record\_write()}{gnutls\_record\_write() (see Section }{)}{gnutls_record_write}
+\hyperref{gnutls\_record\_recv()}{gnutls\_record\_recv() (see Section }{)}{gnutls_record_recv} and
+\hyperref{gnutls\_record\_send()}{gnutls\_record\_send() (see Section }{)}{gnutls_record_send}
functions.
\par
i = 0;
for (;;) {
bzero(buffer, MAX_BUF + 1);
- ret = gnutls_record_read( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( state, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
if (ret > 0) {
/* echo data back to the client
*/
- gnutls_record_write( state, buffer,
+ gnutls_record_send( state, buffer,
strlen(buffer));
}
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
printf("- Handshake was completed\n");
}
- gnutls_record_write( state, MSG, strlen(MSG));
+ gnutls_record_send( state, MSG, strlen(MSG));
- ret = gnutls_record_read( state, buffer, MAX_BUF);
+ ret = gnutls_record_recv( state, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) == 1 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GNUTLS connection\n");
void gnutls_perror( int error);
const char* gnutls_strerror( int error);
-ssize_t gnutls_record_write( GNUTLS_STATE state, void *data, size_t sizeofdata);
-ssize_t gnutls_record_read( GNUTLS_STATE state, void *data, size_t sizeofdata);
-#define gnutls_read gnutls_record_read
-#define gnutls_write gnutls_record_write
+ssize_t gnutls_record_send( GNUTLS_STATE state, void *data, size_t sizeofdata);
+ssize_t gnutls_record_recv( GNUTLS_STATE state, void *data, size_t sizeofdata);
+#define gnutls_read gnutls_record_recv
+#define gnutls_write gnutls_record_send
/* functions to set priority of cipher suites */
int gnutls_cipher_set_priority( GNUTLS_STATE state, GNUTLS_LIST);
/**
- * gnutls_record_write - sends to the peer the specified data
+ * gnutls_record_send - sends to the peer the specified data
* @state: is a &GNUTLS_STATE structure.
* @data: contains the data to send
* @sizeofdata: is the length of the data
* Returns the number of bytes sent, or a negative error code.
*
**/
-ssize_t gnutls_record_write( GNUTLS_STATE state, const void *data, size_t sizeofdata) {
+ssize_t gnutls_record_send( GNUTLS_STATE state, const void *data, size_t sizeofdata) {
return gnutls_send_int( state, GNUTLS_APPLICATION_DATA, -1, data, sizeofdata);
}
/**
- * gnutls_record_read - reads data from the TLS record protocol
+ * gnutls_record_recv - reads data from the TLS record protocol
* @state: is a &GNUTLS_STATE structure.
* @data: contains the data to send
* @sizeofdata: is the length of the data
* or perform a handshake again. (only a client may receive this message)
*
**/
-ssize_t gnutls_record_read( GNUTLS_STATE state, void *data, size_t sizeofdata) {
+ssize_t gnutls_record_recv( GNUTLS_STATE state, void *data, size_t sizeofdata) {
return gnutls_recv_int( state, GNUTLS_APPLICATION_DATA, -1, data, sizeofdata);
}
if (FD_ISSET(sd, &rset)) {
bzero(buffer, MAX_BUF + 1);
do {
- ret = gnutls_read(state, buffer, MAX_BUF);
+ ret = gnutls_record_recv(state, buffer, MAX_BUF);
} while (ret == GNUTLS_E_INTERRUPTED
|| ret == GNUTLS_E_AGAIN);
/* remove new line */
}
do {
ret =
- gnutls_write(state, buffer,
+ gnutls_record_send(state, buffer,
strlen(buffer));
} while (ret == GNUTLS_E_AGAIN
|| ret == GNUTLS_E_INTERRUPTED);
ptr = data;
for (n = 1; n < data_size; n++) {
do {
- rc = gnutls_read(state, &c, 1);
+ rc = gnutls_record_recv(state, &c, 1);
} while (rc == GNUTLS_E_INTERRUPTED
|| rc == GNUTLS_E_AGAIN);
strlen(buffer));
do {
ret =
- gnutls_write(state,
+ gnutls_record_send(state,
buffer,
strlen
(buffer));
strcat(http_buffer, HTTP_END);
do {
ret =
- gnutls_write(state,
+ gnutls_record_send(state,
http_buffer,
strlen
(http_buffer));