More extraction of functionality
Extracting server and tty functions into separate headers. Thread functions for new connections, tty data and client data are also extracted and used as separate functional blocks.
This commit is contained in:
parent
2c26ef201a
commit
c17e696566
11 changed files with 534 additions and 393 deletions
24
common.h
Normal file
24
common.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define DATABUF_LEN 128
|
||||
|
||||
#define TIMESTAMP_FORMAT "%Y-%m-%dT%H:%M:%S" /* ISO 8601 */
|
||||
#define TIMESTAMP_LEN 20+1 /* calculated according to the timestamp format */
|
||||
|
||||
/* Global variables used throughout the application. */
|
||||
int debug_messages; /* if > 0 debug messages will be printed */
|
||||
|
||||
/* Global functions used throughout the application. */
|
||||
|
||||
/**
|
||||
* Converts time in seconds from Epoch to a conveniently formatted string.
|
||||
*/
|
||||
void time2string(time_t time, char* timestamp);
|
Loading…
Add table
Add a link
Reference in a new issue