Skip to content

Commit 1c6959f

Browse files
committed
Replaced tabs with 4 whitespaces and removed trailing whitespaces.
Signed-off-by: Victor Toni <[email protected]>
1 parent 160ac2d commit 1c6959f

22 files changed

+503
-537
lines changed

src/callout.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** igmpproxy - IGMP proxy based multicast router
2+
** igmpproxy - IGMP proxy based multicast router
33
** Copyright (C) 2005 Johnny Egeland <[email protected]>
44
**
55
** This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,7 @@ static struct timeOutQueue *queue = 0; /* pointer to the beginning of timeout q
4141

4242
struct timeOutQueue {
4343
struct timeOutQueue *next; // Next event in queue
44-
int id;
44+
int id;
4545
timer_f func; // function to call
4646
void *data; // Data for function
4747
int time; // Time offset for next event
@@ -131,19 +131,19 @@ int timer_nextTimer(void) {
131131
* @param data - Pointer to the function data to supply...
132132
*/
133133
int timer_setTimer(int delay, timer_f action, void *data) {
134-
struct timeOutQueue *ptr, *node, *prev;
134+
struct timeOutQueue *ptr, *node, *prev;
135135
int i = 0;
136136

137-
/* create a node */
137+
/* create a node */
138138
node = (struct timeOutQueue *)malloc(sizeof(struct timeOutQueue));
139139
if (node == 0) {
140140
my_log(LOG_WARNING, 0, "Malloc Failed in timer_settimer\n");
141141
return -1;
142142
}
143-
node->func = action;
143+
node->func = action;
144144
node->data = data;
145-
node->time = delay;
146-
node->next = 0;
145+
node->time = delay;
146+
node->next = 0;
147147
node->id = ++id;
148148

149149
prev = ptr = queue;
@@ -167,10 +167,10 @@ int timer_setTimer(int delay, timer_f action, void *data) {
167167
prev->next = node;
168168
}
169169
ptr->time -= node->time;
170-
my_log(LOG_DEBUG, 0,
171-
"Created timeout %d (#%d) - delay %d secs",
172-
node->id, i, node->time);
173-
debugQueue();
170+
my_log(LOG_DEBUG, 0,
171+
"Created timeout %d (#%d) - delay %d secs",
172+
node->id, i, node->time);
173+
debugQueue();
174174
return node->id;
175175
} else {
176176
// Continur to check nodes.
@@ -182,15 +182,15 @@ int timer_setTimer(int delay, timer_f action, void *data) {
182182
}
183183
prev->next = node;
184184
}
185-
my_log(LOG_DEBUG, 0, "Created timeout %d (#%d) - delay %d secs",
185+
my_log(LOG_DEBUG, 0, "Created timeout %d (#%d) - delay %d secs",
186186
node->id, i, node->time);
187187
debugQueue();
188188

189189
return node->id;
190190
}
191191

192192
/**
193-
* returns the time until the timer is scheduled
193+
* returns the time until the timer is scheduled
194194
*/
195195
int timer_leftTimer(int timer_id) {
196196
struct timeOutQueue *ptr;
@@ -209,7 +209,7 @@ int timer_leftTimer(int timer_id) {
209209
}
210210

211211
/**
212-
* clears the associated timer. Returns 1 if succeeded.
212+
* clears the associated timer. Returns 1 if succeeded.
213213
*/
214214
int timer_clearTimer(int timer_id) {
215215
struct timeOutQueue *ptr, *prev;
@@ -264,6 +264,6 @@ static void debugQueue(void) {
264264
struct timeOutQueue *ptr;
265265

266266
for (ptr = queue; ptr; ptr = ptr->next) {
267-
my_log(LOG_DEBUG, 0, "(Id:%d, Time:%d) ", ptr->id, ptr->time);
267+
my_log(LOG_DEBUG, 0, "(Id:%d, Time:%d) ", ptr->id, ptr->time);
268268
}
269269
}

src/config.c

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** igmpproxy - IGMP proxy based multicast router
2+
** igmpproxy - IGMP proxy based multicast router
33
** Copyright (C) 2005 Johnny Egeland <[email protected]>
44
**
55
** This program is free software; you can redistribute it and/or modify
@@ -33,12 +33,12 @@
3333
*/
3434
/**
3535
* config.c - Contains functions to load and parse config
36-
* file, and functions to configure the daemon.
36+
* file, and functions to configure the daemon.
3737
*/
3838

3939
#include "igmpproxy.h"
40-
41-
// Structure to keep configuration for VIFs...
40+
41+
// Structure to keep configuration for VIFs...
4242
struct vifconfig {
4343
char* name;
4444
short state;
@@ -50,13 +50,13 @@ struct vifconfig {
5050

5151
// Allowed Groups
5252
struct SubnetList* allowedgroups;
53-
53+
5454
// Next config in list...
5555
struct vifconfig* next;
5656
};
57-
57+
5858
// Structure to keep vif configuration
59-
struct vifconfig* vifconf;
59+
struct vifconfig *vifconf;
6060

6161
// Keeps common settings...
6262
static struct Config commonConfig;
@@ -65,7 +65,6 @@ static struct Config commonConfig;
6565
struct vifconfig *parsePhyintToken(void);
6666
struct SubnetList *parseSubnetAddress(char *addrstr);
6767

68-
6968
/**
7069
* Initializes common config..
7170
*/
@@ -84,11 +83,10 @@ static void initCommonConfig(void) {
8483

8584
// If 1, a leave message is sent upstream on leave messages from downstream.
8685
commonConfig.fastUpstreamLeave = 0;
87-
86+
8887
// aimwang: default value
8988
commonConfig.defaultInterfaceState = IF_STATE_DISABLED;
9089
commonConfig.rescanVif = 0;
91-
9290
}
9391

9492
/**
@@ -99,14 +97,14 @@ struct Config *getCommonConfig(void) {
9997
}
10098

10199
/**
102-
* Loads the configuration from file, and stores the config in
100+
* Loads the configuration from file, and stores the config in
103101
* respective holders...
104-
*/
102+
*/
105103
int loadConfig(char *configFile) {
106104
struct vifconfig *tmpPtr;
107105
struct vifconfig **currPtr = &vifconf;
108106
char *token;
109-
107+
110108
// Initialize common config
111109
initCommonConfig();
112110

@@ -146,29 +144,29 @@ int loadConfig(char *configFile) {
146144
*currPtr = tmpPtr;
147145
currPtr = &tmpPtr->next;
148146
}
149-
}
147+
}
150148
else if(strcmp("quickleave", token)==0) {
151149
// Got a quickleave token....
152150
my_log(LOG_DEBUG, 0, "Config: Quick leave mode enabled.");
153151
commonConfig.fastUpstreamLeave = 1;
154-
152+
155153
// Read next token...
156154
token = nextConfigToken();
157155
continue;
158156
}
159157
else if(strcmp("defaultdown", token)==0) {
160-
// Got a defaultdown token...
161-
my_log(LOG_DEBUG, 0, "Config: interface Default as down stream.");
162-
commonConfig.defaultInterfaceState = IF_STATE_DOWNSTREAM;
158+
// Got a defaultdown token...
159+
my_log(LOG_DEBUG, 0, "Config: interface Default as down stream.");
160+
commonConfig.defaultInterfaceState = IF_STATE_DOWNSTREAM;
163161

164162
// Read next token...
165163
token = nextConfigToken();
166164
continue;
167165
}
168166
else if(strcmp("rescanvif", token)==0) {
169-
// Got a defaultdown token...
170-
my_log(LOG_DEBUG, 0, "Config: Need detect new interace.");
171-
commonConfig.rescanVif = 1;
167+
// Got a defaultdown token...
168+
my_log(LOG_DEBUG, 0, "Config: Need detect new interace.");
169+
commonConfig.rescanVif = 1;
172170

173171
// Read next token...
174172
token = nextConfigToken();
@@ -216,19 +214,19 @@ void configureVifs(void) {
216214
my_log(LOG_DEBUG, 0, "Found config for %s", Dp->Name);
217215

218216

219-
// Set the VIF state
217+
// Set the VIF state
220218
Dp->state = confPtr->state;
221-
219+
222220
Dp->threshold = confPtr->threshold;
223221
Dp->ratelimit = confPtr->ratelimit;
224222

225223
// Go to last allowed net on VIF...
226224
for(vifLast = Dp->allowednets; vifLast->next; vifLast = vifLast->next);
227-
225+
228226
// Insert the configured nets...
229227
vifLast->next = confPtr->allowednets;
230228

231-
Dp->allowedgroups = confPtr->allowedgroups;
229+
Dp->allowedgroups = confPtr->allowedgroups;
232230

233231
break;
234232
}
@@ -277,7 +275,7 @@ struct vifconfig *parsePhyintToken(void) {
277275

278276
// Set the altnet pointer to the allowednets pointer.
279277
anetPtr = &tmpPtr->allowednets;
280-
agrpPtr = &tmpPtr->allowedgroups;
278+
agrpPtr = &tmpPtr->allowedgroups;
281279

282280
// Parse the rest of the config..
283281
token = nextConfigToken();
@@ -296,20 +294,20 @@ struct vifconfig *parsePhyintToken(void) {
296294
anetPtr = &(*anetPtr)->next;
297295
}
298296
}
299-
else if(strcmp("whitelist", token)==0) {
300-
// Whitelist
301-
token = nextConfigToken();
302-
my_log(LOG_DEBUG, 0, "Config: IF: Got whitelist token %s.", token);
303-
304-
*agrpPtr = parseSubnetAddress(token);
305-
if(*agrpPtr == NULL) {
306-
parseError = 1;
307-
my_log(LOG_WARNING, 0, "Unable to parse subnet address.");
308-
break;
309-
} else {
310-
agrpPtr = &(*agrpPtr)->next;
311-
}
312-
}
297+
else if(strcmp("whitelist", token)==0) {
298+
// Whitelist
299+
token = nextConfigToken();
300+
my_log(LOG_DEBUG, 0, "Config: IF: Got whitelist token %s.", token);
301+
302+
*agrpPtr = parseSubnetAddress(token);
303+
if(*agrpPtr == NULL) {
304+
parseError = 1;
305+
my_log(LOG_WARNING, 0, "Unable to parse subnet address.");
306+
break;
307+
} else {
308+
agrpPtr = &(*agrpPtr)->next;
309+
}
310+
}
313311
else if(strcmp("upstream", token)==0) {
314312
// Upstream
315313
my_log(LOG_DEBUG, 0, "Config: IF: Got upstream token.");
@@ -369,10 +367,10 @@ struct vifconfig *parsePhyintToken(void) {
369367
* a.b.c.d/n into a SubnetList entry.
370368
*/
371369
struct SubnetList *parseSubnetAddress(char *addrstr) {
372-
struct SubnetList *tmpSubnet;
373-
char *tmpStr;
374-
uint32_t addr = 0x00000000;
375-
uint32_t mask = 0xFFFFFFFF;
370+
struct SubnetList *tmpSubnet;
371+
char *tmpStr;
372+
uint32_t addr = 0x00000000;
373+
uint32_t mask = 0xFFFFFFFF;
376374

377375
// First get the network part of the address...
378376
tmpStr = strtok(addrstr, "/");
@@ -403,7 +401,7 @@ struct SubnetList *parseSubnetAddress(char *addrstr) {
403401
tmpSubnet->next = NULL;
404402

405403
my_log(LOG_DEBUG, 0, "Config: IF: Altnet: Parsed altnet to %s.",
406-
inetFmts(tmpSubnet->subnet_addr, tmpSubnet->subnet_mask,s1));
404+
inetFmts(tmpSubnet->subnet_addr, tmpSubnet->subnet_mask,s1));
407405

408406
return tmpSubnet;
409407
}

src/confread.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** igmpproxy - IGMP proxy based multicast router
2+
** igmpproxy - IGMP proxy based multicast router
33
** Copyright (C) 2005 Johnny Egeland <[email protected]>
44
**
55
** This program is free software; you can redistribute it and/or modify
@@ -38,19 +38,19 @@
3838
* and read the tokens from it. The parser is really simple,
3939
* and does no backlogging. This means that no form of
4040
* text escaping and qouting is currently supported.
41-
* '#' chars are read as comments, and the comment lasts until
41+
* '#' chars are read as comments, and the comment lasts until
4242
* a newline or EOF
4343
*
4444
*/
4545

4646
#include "igmpproxy.h"
4747

48-
#define READ_BUFFER_SIZE 512 // Inputbuffer size...
49-
48+
#define READ_BUFFER_SIZE 512 // Inputbuffer size...
49+
5050
#ifndef MAX_TOKEN_LENGTH
51-
#define MAX_TOKEN_LENGTH 30 // Default max token length
51+
#define MAX_TOKEN_LENGTH 30 // Default max token length
5252
#endif
53-
53+
5454
FILE *confFilePtr; // File handle pointer
5555
char *iBuffer; // Inputbuffer for reading...
5656
unsigned int bufPtr; // Buffer position pointer.
@@ -60,28 +60,28 @@ short validToken;
6060

6161
/**
6262
* Opens config file specified by filename.
63-
*/
63+
*/
6464
int openConfigFile(char *filename) {
6565

6666
// Set the buffer to null initially...
6767
iBuffer = NULL;
6868

6969
// Open the file for reading...
7070
confFilePtr = fopen(filename, "r");
71-
71+
7272
// On error, return false
7373
if(confFilePtr == NULL) {
7474
return 0;
7575
}
76-
76+
7777
// Allocate memory for inputbuffer...
7878
iBuffer = (char*) malloc( sizeof(char) * READ_BUFFER_SIZE );
79-
79+
8080
if(iBuffer == NULL) {
8181
closeConfigFile();
8282
return 0;
8383
}
84-
84+
8585
// Reset bufferpointer and readsize
8686
bufPtr = 0;
8787
readSize = 0;
@@ -105,7 +105,7 @@ void closeConfigFile(void) {
105105

106106
/**
107107
* Returns the next token from the configfile. The function
108-
* return NULL if there are no more tokens in the file.
108+
* return NULL if there are no more tokens in the file.
109109
*/
110110
char *nextConfigToken(void) {
111111

@@ -174,7 +174,6 @@ char *nextConfigToken(void) {
174174
cToken[tokenPtr++] = iBuffer[bufPtr];
175175
break;
176176
}
177-
178177
}
179178

180179
// Check end of token buffer !!!
@@ -211,4 +210,3 @@ char *nextConfigToken(void) {
211210
char *getCurrentConfigToken(void) {
212211
return validToken ? cToken : NULL;
213212
}
214-

0 commit comments

Comments
 (0)