COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
transferlib.cpp File Reference
#include "support/transferlib.h"
#include "support/timelib.h"
#include <iostream>
#include <sys/stat.h>
Include dependency graph for transferlib.cpp:

Functions

bool IS_METADATA (const unsigned char P_TYPE)
 
bool IS_DATA (const unsigned char P_TYPE)
 
bool IS_REQDATA (const unsigned char P_TYPE)
 
bool IS_REQMETA (const unsigned char P_TYPE)
 
bool IS_COMPLETE (const unsigned char P_TYPE)
 
bool IS_CANCEL (const unsigned char P_TYPE)
 
bool IS_QUEUE (const unsigned char P_TYPE)
 
void make_complete_packet (vector< PACKET_BYTE > &packet, packet_struct_complete complete)
 
void make_complete_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, PACKET_TX_ID_TYPE tx_id)
 
void extract_complete (vector< PACKET_BYTE > &packet, packet_struct_complete &complete)
 
void extract_complete (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE &node_id, PACKET_TX_ID_TYPE &tx_id)
 
void make_cancel_packet (vector< PACKET_BYTE > &packet, packet_struct_cancel cancel)
 
void make_cancel_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, PACKET_TX_ID_TYPE tx_id)
 
void extract_cancel (vector< PACKET_BYTE > &packet, packet_struct_cancel &cancel)
 
void extract_cancel (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE &node_id, PACKET_TX_ID_TYPE &tx_id)
 
void make_reqmeta_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string node_name, vector< PACKET_TX_ID_TYPE > reqmeta)
 
void extract_reqmeta (vector< PACKET_BYTE > &packet, packet_struct_reqmeta &reqmeta)
 
void make_reqdata_packet (vector< PACKET_BYTE > &packet, packet_struct_reqdata reqdata)
 
void make_reqdata_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, PACKET_TX_ID_TYPE tx_id, PACKET_FILE_SIZE_TYPE hole_start, PACKET_FILE_SIZE_TYPE hole_end)
 
void extract_reqdata (vector< PACKET_BYTE > &packet, packet_struct_reqdata &reqdata)
 
void extract_reqdata (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE &node_id, PACKET_TX_ID_TYPE &tx_id, PACKET_FILE_SIZE_TYPE &hole_start, PACKET_FILE_SIZE_TYPE &hole_end)
 
void make_metadata_packet (vector< PACKET_BYTE > &packet, packet_struct_metalong meta)
 
void make_metadata_packet (vector< PACKET_BYTE > &packet, PACKET_TX_ID_TYPE tx_id, char *file_name, PACKET_FILE_SIZE_TYPE file_size, char *node_name, char *agent_name)
 
void make_metadata_packet (vector< PACKET_BYTE > &packet, packet_struct_metashort meta)
 
void make_metadata_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, PACKET_TX_ID_TYPE tx_id, char *file_name, PACKET_FILE_SIZE_TYPE file_size, char *agent_name)
 
void extract_metadata (vector< PACKET_BYTE > &packet, packet_struct_metalong &meta)
 
void extract_metadata (vector< PACKET_BYTE > &packet, PACKET_TX_ID_TYPE &tx_id, char *file_name, PACKET_FILE_SIZE_TYPE &file_size, char *node_name, char *agent_name)
 
void extract_metadata (vector< PACKET_BYTE > &packet, packet_struct_metashort &meta)
 
void extract_metadata (vector< PACKET_BYTE > &packet, PACKET_TX_ID_TYPE &tx_id, char *file_name, PACKET_FILE_SIZE_TYPE &file_size, PACKET_NODE_ID_TYPE &node_id, char *agent_name)
 
void make_data_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, PACKET_TX_ID_TYPE tx_id, PACKET_CHUNK_SIZE_TYPE byte_count, PACKET_FILE_SIZE_TYPE chunk_start, PACKET_BYTE *chunk)
 
void extract_data (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE &node_id, PACKET_TX_ID_TYPE &tx_id, PACKET_CHUNK_SIZE_TYPE &byte_count, PACKET_FILE_SIZE_TYPE &chunk_start, PACKET_BYTE *chunk)
 
void make_reqqueue_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string node_name)
 
void extract_reqqueue (vector< PACKET_BYTE > &packet, packet_struct_reqqueue &reqqueue)
 
void make_queue_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string node_name, vector< PACKET_TX_ID_TYPE > queue)
 
void extract_queue (vector< PACKET_BYTE > &packet, packet_struct_queue &queue)
 
void make_heartbeat_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string node_name, PACKET_BYTE beat_period, PACKET_UNIXTIME_TYPE throughput, PACKET_UNIXTIME_TYPE funixtime)
 
void extract_heartbeat (vector< PACKET_BYTE > &packet, packet_struct_heartbeat &heartbeat)
 
void make_message_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string message)
 
void extract_message (vector< PACKET_BYTE > &packet, packet_struct_message &message)
 
void make_command_packet (vector< PACKET_BYTE > &packet, PACKET_NODE_ID_TYPE node_id, string command)
 
void extract_command (vector< PACKET_BYTE > &packet, packet_struct_command &command)
 
void show_fstream_state (std::ifstream &)
 ------------— code above this line has be checked and de-Jonny-fied More...
 
time_t get_file_age (string filename)
 
int32_t get_file_size (string filename)
 Get size of file. More...
 
int32_t get_file_size (const char *filename)
 
void print_cstring (uint8_t *buf, int siz)
 
void print_cstring_with_index (uint8_t *buf, int siz)
 
void print_cstring_hex (uint8_t *buf, int siz)
 
void print_cstring_hex_with_index (uint8_t *buf, int siz)
 
void unable_to_remove (string filename)
 
PACKET_TYPE salt_type (PACKET_TYPE type)
 
int32_t check_node_id (PACKET_NODE_ID_TYPE node_id)
 
int32_t lookup_node_id (string node_name)
 
string lookup_node_id_name (PACKET_NODE_ID_TYPE node_id)
 
int32_t load_nodeids ()
 
vector< string > get_nodeids ()
 

Variables

static vector< string > nodeids
 

Function Documentation

bool IS_CANCEL ( const unsigned char  P_TYPE)
46 { return (((P_TYPE & 0x0f) & PACKET_CANCEL) != 0); }
static const unsigned char PACKET_CANCEL
Definition: transferlib.h:108
bool IS_QUEUE ( const unsigned char  P_TYPE)
47 { return (((P_TYPE & 0x0f) & PACKET_QUEUE) != 0); }
static const unsigned char PACKET_QUEUE
Definition: transferlib.h:109
time_t get_file_age ( string  filename)
381 {
382  struct stat stat_buf;
383  if (stat(filename.c_str(), &stat_buf) != 0)
384  {
385  return 0;
386  }
387  else
388  {
389  struct timeval cmjd = utc2unix(currentmjd(0.));
390  return (cmjd.tv_sec-stat_buf.st_mtime);
391  }
392 }
static double cmjd
Definition: agent_monitor.cpp:121
struct timeval utc2unix(double utc)
UTC to Unix time.
Definition: timelib.cpp:152
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65

Variable Documentation

vector<string> nodeids
static

the Node ID lookup table