UnixFaxServer.h
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:3k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /* $Id: UnixFaxServer.h,v 1.2 2009/03/02 04:54:14 faxguy Exp $ */
  2. /*
  3.  * Copyright (c) 1995-1996 Sam Leffler
  4.  * Copyright (c) 1995-1996 Silicon Graphics, Inc.
  5.  * HylaFAX is a trademark of Silicon Graphics
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26. #ifndef _UnixFaxServer_
  27. #define _UnixFaxServer_
  28. #include "HylaFAXServer.h"
  29. #include <sys/un.h>
  30. class UnixFaxServer : public HylaFAXServer {
  31. private:
  32.     sockaddr_un ctrl_addr; // control socket connection
  33.     sockaddr_un data_source; // source of data connection
  34.     sockaddr_un data_dest; // destination of data connection
  35.     sockaddr_un peer_addr; // destination of control connection
  36.     bool usedefault; // for data transfers
  37.     void passiveCmd(void);
  38.     void netStatus(FILE*);
  39.     bool hostPort();
  40.     void portCmd(Token);
  41.     virtual void initServer(void);
  42.     FILE* getDataSocket(const char* mode);
  43.     bool dataConnect(void);
  44.     FILE* openDataConn(const char* mode, int& code);
  45.     void send_data(FILE* instr, FILE* outstr, off_t blksize);
  46.     bool receive_data(FILE* instr, FILE* outstr);
  47. public:
  48.     UnixFaxServer();
  49.     virtual ~UnixFaxServer();
  50.     virtual void open(void);
  51. };
  52. #include "SuperServer.h"
  53. class UnixSuperServer : public SuperServer {
  54. private:
  55.     fxStr fileName; // UNIX domain socket filename
  56. protected:
  57.     bool startServer(void);
  58.     HylaFAXServer* newChild(void);
  59. public:
  60.     UnixSuperServer(const char* filename, int backlog = 5);
  61.     ~UnixSuperServer();
  62. };
  63. #endif /* _UnixFaxServer_ */