/[monit]/monit/net.c
ViewVC logotype

Diff of /monit/net.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by rory, Thu Sep 12 01:48:03 2002 UTC revision 1.14 by chopp, Wed Sep 25 14:54:48 2002 UTC
# Line 74  Line 74 
74    
75  #include "monitor.h"  #include "monitor.h"
76  #include "net.h"  #include "net.h"
77    #include "ssl.h"
78    
79  /**  /**
80   *  General purpose Network and Socket methods.   *  General purpose Network and Socket methods.
# Line 447  int set_block(int socket) { Line 448  int set_block(int socket) {
448    
449  }  }
450    
451    /**
452     * Send the message 'msg' down a port in non-blocking mode and
453     * with failover. Uses SSL if necessary.
454     * @param p port handler
455     * @param msg The message to send
456     * @param len The length of the message in bytes
457     * @param flags Optional send flags
458     * @return The bytes sent or -1 if an error occured
459     */
460    int port_send(Port_T p, const char *msg, int len, int flags) {
461    
462      if (p->ssl!=NULL) {
463    
464        return send_ssl_socket(p->ssl, (void *) msg, len);
465    
466      } else {
467    
468        return sock_send(p->socket, msg, len, flags);
469    
470      }
471    
472    }
473    
474    /**
475     * Read a message from the socket in non-blocking mode and
476     * with failover. Uses SSL if necessary.
477     * @param sock A port handler
478     * @param buf The buffer to read a message into
479     * @param len The length of the buffer
480     * @param flags Optional recv flags
481     * @return Returns the bytes read or -1 if an error occured
482     */
483    int port_recv(Port_T p, char *buf, int len, int flags) {
484    
485      if (p->ssl!=NULL) {
486        int error;
487        error = recv_ssl_socket(p->ssl, buf, len);
488    
489        return error;
490    
491      } else {
492    
493        return sock_recv(p->socket, buf, len, flags);
494    
495      }
496    }
497    
498    
499  /**  /**
500   * Send the message 'msg' down the socket in non-blocking mode and   * Send the message 'msg' down the socket in non-blocking mode and

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26