summaryrefslogtreecommitdiff
path: root/src/libnml/buffer/tcpmem.hh
blob: 469c4ab6b9f43855d78e67d005bc6c037a6f4450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/********************************************************************
* Description: tcpmem.hh
*
*   Derived from a work by Fred Proctor & Will Shackleford
*
* Author:
* License: GPL Version 2
* System: Linux
*    
* Copyright (c) 2004 All rights reserved.
*
* Last change: 
********************************************************************/

#ifndef TCPMEM_HH
#define TCPMEM_HH

#include "cms.hh"		/* class CMS */
#include "rem_msg.hh"		// REMOTE_CMS_REQUEST_TYPE

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif
class TCPMEM:public CMS {
  public:
    TCPMEM(const char *bufline, const char *procline);
      virtual ~ TCPMEM();

    /* Overloaded CMS functions. */
    CMS_STATUS clear();
    int check_if_read();
    int get_msg_count();
    int get_queue_length();
    int get_space_available();
    CMS_STATUS read();
    CMS_STATUS blocking_read(double);
    CMS_STATUS peek();
    CMS_STATUS write(void *data);
    CMS_STATUS write_if_read(void *data);
//    int login(const char *, const char *);
    void reconnect();
    void disconnect();
    CMS_DIAGNOSTICS_INFO *get_diagnostics_info();

  protected:
      CMS_STATUS handle_old_replies();
    void send_diag_info();
    char diag_info_buf[0x400];
    int recvd_bytes;
    long serial_number;
    long returned_serial_number;
    int subscription_type;
    int poll_interval_millis;
    struct hostent *server_host_entry;
    struct sockaddr_in server_socket_address;
    int socket_fd;
    char temp_buffer[0x2000];
    REMOTE_CMS_REQUEST_TYPE timedout_request;
    long bytes_to_throw_away;
    int polling;
    int write_socket_fd;
    int read_socket_fd;
    long write_serial_number;
    long read_serial_number;
    void set_socket_fds(int new_fd);
    CMS_STATUS timedout_request_status;
    unsigned long timedout_request_writeid;
    int max_consecutive_timeouts;
    int waiting_for_message;
    unsigned long waiting_message_size;
    unsigned long waiting_message_id;
    int autoreconnect;
    int reconnect_needed;
    int sigpipe_count;
    void (*old_handler) (int);
    void disable_sigpipe();
    void reenable_sigpipe();
    void verify_bufname();
    int subscription_count;
};

#endif