Use clang-format to format (somewhat) LLVM-style (fixes #44)

This commit is contained in:
Arnout Engelen
2016-03-21 00:31:48 +01:00
parent ac045b487a
commit e74935da1f
24 changed files with 2369 additions and 2561 deletions

176
process.h
View File

@@ -1,4 +1,4 @@
/*
/*
* process.h
*
* Copyright (c) 2004-2006,2008,2011 Arnout Engelen
@@ -15,11 +15,11 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
*USA.
*
*/
#ifndef __PROCESS_H
#define __PROCESS_H
@@ -30,123 +30,103 @@
extern bool tracemode;
extern bool bughuntmode;
void check_all_procs ();
void check_all_procs();
class ConnList
{
class ConnList {
public:
ConnList (Connection * m_val, ConnList * m_next)
{
assert (m_val != NULL);
val = m_val; next = m_next;
}
~ConnList ()
{
/* does not delete its value, to allow a connection to
* remove itself from the global connlist in its destructor */
}
Connection * getVal ()
{
return val;
}
void setNext (ConnList * m_next)
{
next = m_next;
}
ConnList * getNext ()
{
return next;
}
ConnList(Connection *m_val, ConnList *m_next) {
assert(m_val != NULL);
val = m_val;
next = m_next;
}
~ConnList() {
/* does not delete its value, to allow a connection to
* remove itself from the global connlist in its destructor */
}
Connection *getVal() { return val; }
void setNext(ConnList *m_next) { next = m_next; }
ConnList *getNext() { return next; }
private:
Connection * val;
ConnList * next;
Connection *val;
ConnList *next;
};
class Process
{
class Process {
public:
/* the process makes a copy of the name. the device name needs to be stable. */
Process (const unsigned long m_inode, const char * m_devicename, const char * m_name = NULL)
: inode (m_inode)
{
//std::cout << "ARN: Process created with dev " << m_devicename << std::endl;
if (DEBUG)
std::cout << "PROC: Process created at " << this << std::endl;
/* the process makes a copy of the name. the device name needs to be stable.
*/
Process(const unsigned long m_inode, const char *m_devicename,
const char *m_name = NULL)
: inode(m_inode) {
// std::cout << "ARN: Process created with dev " << m_devicename <<
// std::endl;
if (DEBUG)
std::cout << "PROC: Process created at " << this << std::endl;
if (m_name == NULL)
name = NULL;
else
name = strdup(m_name);
if (m_name == NULL)
name = NULL;
else
name = strdup(m_name);
devicename = m_devicename;
connections = NULL;
pid = 0;
uid = 0;
}
void check () {
assert (pid >= 0);
}
~Process ()
{
free (name);
if (DEBUG)
std::cout << "PROC: Process deleted at " << this << std::endl;
}
int getLastPacket ();
devicename = m_devicename;
connections = NULL;
pid = 0;
uid = 0;
}
void check() { assert(pid >= 0); }
void gettotal( u_int32_t * recvd, u_int32_t * sent);
void getkbps (float * recvd, float * sent);
void gettotalmb(float * recvd, float * sent);
void gettotalkb(float * recvd, float * sent);
void gettotalb (float * recvd, float * sent);
~Process() {
free(name);
if (DEBUG)
std::cout << "PROC: Process deleted at " << this << std::endl;
}
int getLastPacket();
char * name;
const char * devicename;
int pid;
void gettotal(u_int32_t *recvd, u_int32_t *sent);
void getkbps(float *recvd, float *sent);
void gettotalmb(float *recvd, float *sent);
void gettotalkb(float *recvd, float *sent);
void gettotalb(float *recvd, float *sent);
ConnList * connections;
uid_t getUid()
{
return uid;
}
char *name;
const char *devicename;
int pid;
void setUid(uid_t m_uid)
{
uid = m_uid;
}
ConnList *connections;
uid_t getUid() { return uid; }
void setUid(uid_t m_uid) { uid = m_uid; }
unsigned long getInode() { return inode; }
unsigned long getInode()
{
return inode;
}
private:
const unsigned long inode;
uid_t uid;
const unsigned long inode;
uid_t uid;
};
class ProcList
{
class ProcList {
public:
ProcList (Process * m_val, ProcList * m_next)
{
assert (m_val != NULL);
val = m_val; next = m_next;
}
int size ();
Process * getVal () { return val; }
ProcList * getNext () { return next; }
ProcList * next;
ProcList(Process *m_val, ProcList *m_next) {
assert(m_val != NULL);
val = m_val;
next = m_next;
}
int size();
Process *getVal() { return val; }
ProcList *getNext() { return next; }
ProcList *next;
private:
Process * val;
Process *val;
};
Process * getProcess (Connection * connection, const char * devicename = NULL);
Process *getProcess(Connection *connection, const char *devicename = NULL);
void process_init ();
void process_init();
void refreshconninode ();
void refreshconninode();
void procclean ();
void procclean();
#endif