/***************************************************************************
                          net.h  -  description
                             -------------------
    begin                : Thu Nov 20 2003
    copyright            : (C) 2003 by Wei Zheng
    email                : v_zheng@yahoo.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef NET_H
#define NET_H

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <stdarg.h>

/**
  *@author Wei Zheng
  */

class net{
public: 
	net();
	~net();

public:
  int fd;
  int debug_switch;

public:
  // Public methods
  /** establish connection with remote msn server */
  int make_connect(char * address, int port);
  /** full read buffer from net file descriptor */
  int full_read(char *buf, int len);
  /** full write buffer to net file descriptor */
  int full_write(char *buf, int len);
  /** send a line to net file descriptor */
  int send_line(char *buf);
  /** get a line from net file descriptor */
  int get_line(int fd, char *buf,int len);
  /** print debuf info */
  int debug(char *fmt,...);
  /** close connection */
  int make_close();
};

#endif
