fix doxygen and put everything besides main function in namespace ebusd

This commit is contained in:
john30
2017-02-25 16:12:09 +01:00
parent d365cb1f9c
commit ca164185dc
31 changed files with 212 additions and 99 deletions
+4
View File
@@ -22,6 +22,8 @@
# include <mach/mach.h>
#endif
namespace ebusd {
#ifdef __MACH__
static bool clockInitialized = false;
static clock_serv_t clockServ;
@@ -41,3 +43,5 @@ void clockGettime(struct timespec* t) {
clock_gettime(CLOCK_REALTIME, t);
#endif
}
} // namespace ebusd
+5 -1
View File
@@ -21,7 +21,9 @@
#include <time.h>
/** \file clock.h */
namespace ebusd {
/** \file lib/utils/clock.h */
/**
* Get the real time system clock.
@@ -29,4 +31,6 @@
*/
void clockGettime(struct timespec* t);
} // namespace ebusd
#endif // LIB_UTILS_CLOCK_H_
+4
View File
@@ -25,6 +25,8 @@
#include <string.h>
#include "lib/utils/clock.h"
namespace ebusd {
/** the name of each @a LogFacility. */
static const char *facilityNames[] = {
"main",
@@ -182,3 +184,5 @@ void logWrite(const char* facility, const LogLevel level, const char* message, .
logWrite(facility, levelNames[level], message, ap);
va_end(ap);
}
} // namespace ebusd
+6 -2
View File
@@ -19,7 +19,9 @@
#ifndef LIB_UTILS_LOG_H_
#define LIB_UTILS_LOG_H_
/** \file log.h */
namespace ebusd {
/** \file lib/utils/log.h */
/** the available log facilities. */
enum LogFacility {
@@ -60,7 +62,7 @@ int parseLogFacilities(const char* facilities);
/**
* Get the log facility as string.
* @param level the @a LogFacility.
* @param facility the @a LogFacility.
* @return the log facility as string.
*/
const char* getLogFacilityStr(LogFacility facility);
@@ -163,4 +165,6 @@ void logWrite(const char* facility, const LogLevel level, const char* message, .
#define logOtherDebug(facility, ...) \
(needsLog(lf_other, ll_debug) ? logWrite(facility, ll_debug, __VA_ARGS__) : void(0))
} // namespace ebusd
#endif // LIB_UTILS_LOG_H_
+5 -3
View File
@@ -22,7 +22,9 @@
#include <unistd.h>
#include <fcntl.h>
/** \file notify.h */
namespace ebusd {
/** \file lib/utils/notify.h */
/**
* class to notify other thread per pipe.
@@ -69,6 +71,6 @@ class Notify {
int m_sendfd;
};
} // namespace ebusd
#endif // LIB_UTILS_NOTIFY_H_
+5 -1
View File
@@ -24,7 +24,9 @@
#include <list>
#include "lib/utils/clock.h"
/** \file queue.h */
namespace ebusd {
/** \file lib/utils/queue.h */
using std::list;
@@ -152,4 +154,6 @@ class Queue {
pthread_cond_t m_cond;
};
} // namespace ebusd
#endif // LIB_UTILS_QUEUE_H_
+4
View File
@@ -27,6 +27,8 @@
#include <string>
#include "lib/utils/clock.h"
namespace ebusd {
using std::streamsize;
RotateFile::~RotateFile() {
@@ -86,3 +88,5 @@ void RotateFile::write(unsigned char* value, unsigned int size, bool received) {
}
}
}
} // namespace ebusd
+5 -2
View File
@@ -25,7 +25,9 @@
#include <fstream>
#include <string>
/** @file rotatefile.h
namespace ebusd {
/** \file lib/utils/rotatefile.h
* Helpers for writing to rotating files.
*/
@@ -92,5 +94,6 @@ class RotateFile {
uint64_t m_fileSize;
};
#endif // LIB_UTILS_ROTATEFILE_H_
} // namespace ebusd
#endif // LIB_UTILS_ROTATEFILE_H_
+7 -4
View File
@@ -23,7 +23,9 @@
#include <string.h>
#include <cstdlib>
TCPSocket::TCPSocket(int sfd, struct sockaddr_in* address) : m_sfd(sfd) {
namespace ebusd {
TCPSocket::TCPSocket(int sfd, socketaddress* address) : m_sfd(sfd) {
char ip[17];
inet_ntop(AF_INET, (struct in_addr*)&(address->sin_addr.s_addr), ip, (socklen_t)sizeof(ip)-1);
m_ip = ip;
@@ -36,7 +38,7 @@ bool TCPSocket::isValid() {
TCPSocket* TCPClient::connect(const string& server, const uint16_t& port) {
struct sockaddr_in address;
socketaddress address;
int ret;
memset(reinterpret_cast<char*>(&address), 0, sizeof(address));
@@ -76,7 +78,7 @@ int TCPServer::start() {
return 0;
}
m_lfd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in address;
socketaddress address;
memset(&address, 0, sizeof(address));
@@ -107,7 +109,7 @@ TCPSocket* TCPServer::newSocket() {
if (!m_listening) {
return NULL;
}
struct sockaddr_in address;
socketaddress address;
socklen_t len = sizeof(address);
memset(&address, 0, sizeof(address));
@@ -119,3 +121,4 @@ TCPSocket* TCPServer::newSocket() {
return new TCPSocket(sfd, &address);
}
} // namespace ebusd
+12 -6
View File
@@ -24,7 +24,12 @@
#include <stdint.h>
#include <string>
/** \file tcpsocket.h */
/** typedef for referencing @a sockaddr_in within namespace. */
typedef struct sockaddr_in socketaddress;
namespace ebusd {
/** \file lib/utils/tcpsocket.h */
using std::string;
@@ -35,7 +40,7 @@ using std::string;
#endif
/**
* class for low level tcp socket operations. (open, close, send, receive).
* Class for low level tcp socket operations. (open, close, send, receive).
*/
class TCPSocket {
public:
@@ -99,14 +104,14 @@ class TCPSocket {
uint16_t m_port;
/** ip address of tcp socket */
string m_ip;
string m_ip;
/**
* private constructor, limited access only for friend classes.
* @param sfd the file desctriptor of tcp socket.
* @param sfd the file descriptor of tcp socket.
* @param address struct which holds the ip address.
*/
TCPSocket(int sfd, struct sockaddr_in* address);
TCPSocket(int sfd, socketaddress* address);
};
/**
@@ -174,5 +179,6 @@ class TCPServer {
bool m_listening;
};
#endif // LIB_UTILS_TCPSOCKET_H_
} // namespace ebusd
#endif // LIB_UTILS_TCPSOCKET_H_
+4
View File
@@ -23,6 +23,8 @@
#include "lib/utils/thread.h"
#include "lib/utils/clock.h"
namespace ebusd {
void* Thread::runThread(void* arg) {
reinterpret_cast<Thread*>(arg)->enter();
return NULL;
@@ -102,3 +104,5 @@ bool WaitThread::Wait(int seconds) {
pthread_mutex_unlock(&m_mutex);
return isRunning();
}
} // namespace ebusd
+5 -1
View File
@@ -21,7 +21,9 @@
#include <pthread.h>
/** \file thread.h */
namespace ebusd {
/** \file lib/utils/thread.h */
/**
* wrapper class for pthread.
@@ -140,4 +142,6 @@ class WaitThread : public Thread {
pthread_cond_t m_cond;
};
} // namespace ebusd
#endif // LIB_UTILS_THREAD_H_