Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Friends
tm_link_rep Struct Reference

#include <tm_link.hpp>

Inheritance diagram for tm_link_rep:
Inheritance graph
[legend]
Collaboration diagram for tm_link_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 tm_link_rep ()
virtual ~tm_link_rep ()
virtual string start ()=0
virtual void write (string s, int channel)=0
virtual stringwatch (int channel)=0
virtual string read (int channel)=0
virtual void listen (int msecs)=0
virtual void interrupt ()=0
virtual void stop ()=0
void write_packet (string s, int channel)
bool complete_packet (int channel)
string read_packet (int channel, int timeout, bool &success)
void secure_server (string cmd)
void secure_client ()
void set_command (command _cmd)
void apply_command ()

Public Attributes

bool alive
string secret
command feed_cmd
int ref_count

Friends

class tm_link

Detailed Description

Definition at line 39 of file tm_link.hpp.


Constructor & Destructor Documentation

Definition at line 46 of file tm_link.hpp.

{}
virtual tm_link_rep::~tm_link_rep ( ) [inline, virtual]

Definition at line 47 of file tm_link.hpp.

{}

Member Function Documentation

void tm_link_rep::apply_command ( ) [inline]

Definition at line 64 of file tm_link.hpp.

{ if (!is_nil (feed_cmd)) feed_cmd->apply (); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool tm_link_rep::complete_packet ( int  channel)

Definition at line 52 of file tm_link.cpp.

                                         {
  return message_complete (watch (channel));
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void tm_link_rep::interrupt ( ) [pure virtual]
virtual void tm_link_rep::listen ( int  msecs) [pure virtual]

Implemented in pipe_link_rep, dyn_link_rep, socket_link_rep, and socket_server_rep.

Here is the caller graph for this function:

virtual string tm_link_rep::read ( int  channel) [pure virtual]
string tm_link_rep::read_packet ( int  channel,
int  timeout,
bool &  success 
)

Definition at line 57 of file tm_link.cpp.

                                                                 {
  success= false;
  string& r= watch (channel);
  time_t start= texmacs_time ();
  while (!message_complete (r)) {
    int n= N(r);
    if (timeout > 0) listen (timeout);
    if (N(r) == n && (texmacs_time () - start >= timeout)) return "";
  }
  if (channel == LINK_OUT && N(r) > 0 && r[0] == '!') {
    secure_server (message_receive (r));
    return "";
  }
  else {
    string back= message_receive (r);
    if (secret != "") back= secret_decode (back, secret);
    success= true;
    return back;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 92 of file tm_link.cpp.

                            {
  if (secret != "") return;
  write ("!", LINK_IN);
  write_packet (rsa_my_public_key (), LINK_IN);
  bool success;
  string r= read_packet (LINK_OUT, 10000, success);
  if (!success) { stop (); return; }
  secret= rsa_decode (r, rsa_my_private_key ());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 83 of file tm_link.cpp.

                                                {
  if (secret != "") return;
  string k= secret_generate ();
  string s= rsa_encode (k, client_public);
  write_packet (s, LINK_IN);
  secret= k;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tm_link_rep::set_command ( command  _cmd) [inline]

Definition at line 63 of file tm_link.hpp.

{ feed_cmd = _cmd; }
virtual string tm_link_rep::start ( ) [pure virtual]

Implemented in pipe_link_rep, dyn_link_rep, socket_link_rep, and socket_server_rep.

Here is the caller graph for this function:

virtual void tm_link_rep::stop ( ) [pure virtual]

Implemented in pipe_link_rep, dyn_link_rep, socket_link_rep, and socket_server_rep.

Here is the caller graph for this function:

virtual string& tm_link_rep::watch ( int  channel) [pure virtual]

Implemented in pipe_link_rep, dyn_link_rep, socket_link_rep, and socket_server_rep.

Here is the caller graph for this function:

virtual void tm_link_rep::write ( string  s,
int  channel 
) [pure virtual]

Implemented in pipe_link_rep, dyn_link_rep, socket_link_rep, and socket_server_rep.

Here is the caller graph for this function:

void tm_link_rep::write_packet ( string  s,
int  channel 
)

Definition at line 46 of file tm_link.cpp.

                                                {
  if (secret != "") s= secret_encode (s, secret);
  write ((as_string (N (s)) * "\n") * s, channel);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class tm_link [friend]

Definition at line 66 of file tm_link.hpp.


Member Data Documentation

Definition at line 40 of file tm_link.hpp.

Definition at line 43 of file tm_link.hpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

Definition at line 41 of file tm_link.hpp.


The documentation for this struct was generated from the following files: