Home | History | Annotate | Download | only in libvncclient
      1 #ifndef TLS_H
      2 #define TLS_H
      3 
      4 /*
      5  *  Copyright (C) 2009 Vic Lee.
      6  *
      7  *  This is free software; you can redistribute it and/or modify
      8  *  it under the terms of the GNU General Public License as published by
      9  *  the Free Software Foundation; either version 2 of the License, or
     10  *  (at your option) any later version.
     11  *
     12  *  This software is distributed in the hope that it will be useful,
     13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  *  GNU General Public License for more details.
     16  *
     17  *  You should have received a copy of the GNU General Public License
     18  *  along with this software; if not, write to the Free Software
     19  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
     20  *  USA.
     21  */
     22 
     23 /* Handle Anonymous TLS Authentication (18) with the server.
     24  * After authentication, client->tlsSession will be set.
     25  */
     26 rfbBool HandleAnonTLSAuth(rfbClient* client);
     27 
     28 /* Handle VeNCrypt Authentication (19) with the server.
     29  * The callback function GetX509Credential will be called.
     30  * After authentication, client->tlsSession will be set.
     31  */
     32 rfbBool HandleVeNCryptAuth(rfbClient* client);
     33 
     34 /* Read desired bytes from TLS session.
     35  * It's a wrapper function over gnutls_record_recv() and return values
     36  * are same as read(), that is, >0 for actual bytes read, 0 for EOF,
     37  * or EAGAIN, EINTR.
     38  * This should be a non-blocking call. Blocking is handled in sockets.c.
     39  */
     40 int ReadFromTLS(rfbClient* client, char *out, unsigned int n);
     41 
     42 /* Write desired bytes to TLS session.
     43  * It's a wrapper function over gnutls_record_send() and it will be
     44  * blocking call, until all bytes are written or error returned.
     45  */
     46 int WriteToTLS(rfbClient* client, char *buf, unsigned int n);
     47 
     48 /* Free TLS resources */
     49 void FreeTLS(rfbClient* client);
     50 
     51 #endif /* TLS_H */
     52