File: stubs.c

package info (click to toggle)
chrony 3.0-4+deb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,496 kB
  • sloc: ansic: 23,531; sh: 2,022; yacc: 866; makefile: 195
file content (418 lines) | stat: -rw-r--r-- 6,401 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
/*
  chronyd/chronyc - Programs for keeping computer clocks accurate.

 **********************************************************************
 * Copyright (C) Miroslav Lichvar  2014-2015
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * 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.
 * 
 **********************************************************************

  =======================================================================

  Function replacements needed when optional features are disabled.

  */

#include "config.h"

#include "clientlog.h"
#include "cmdmon.h"
#include "keys.h"
#include "logging.h"
#include "manual.h"
#include "memory.h"
#include "nameserv.h"
#include "nameserv_async.h"
#include "ntp_core.h"
#include "ntp_io.h"
#include "ntp_sources.h"
#include "ntp_signd.h"
#include "privops.h"
#include "refclock.h"
#include "sched.h"
#include "util.h"

#ifndef FEAT_ASYNCDNS

/* This is a blocking implementation used when asynchronous resolving is not available */

struct DNS_Async_Instance {
  const char *name;
  DNS_NameResolveHandler handler;
  void *arg;
  int pipe[2];
};

static void
resolve_name(int fd, int event, void *anything)
{
  struct DNS_Async_Instance *inst;
  IPAddr addrs[DNS_MAX_ADDRESSES];
  DNS_Status status;
  int i;

  inst = (struct DNS_Async_Instance *)anything;

  SCH_RemoveFileHandler(inst->pipe[0]);
  close(inst->pipe[0]);
  close(inst->pipe[1]);

  status = PRV_Name2IPAddress(inst->name, addrs, DNS_MAX_ADDRESSES);

  for (i = 0; status == DNS_Success && i < DNS_MAX_ADDRESSES &&
       addrs[i].family != IPADDR_UNSPEC; i++)
    ;

  (inst->handler)(status, i, addrs, inst->arg);

  Free(inst);
}

void
DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *anything)
{
  struct DNS_Async_Instance *inst;

  inst = MallocNew(struct DNS_Async_Instance);
  inst->name = name;
  inst->handler = handler;
  inst->arg = anything;

  if (pipe(inst->pipe))
    LOG_FATAL(LOGF_Nameserv, "pipe() failed");

  UTI_FdSetCloexec(inst->pipe[0]);
  UTI_FdSetCloexec(inst->pipe[1]);

  SCH_AddFileHandler(inst->pipe[0], SCH_FILE_INPUT, resolve_name, inst);

  if (write(inst->pipe[1], "", 1) < 0)
    ;
}

#endif /* !FEAT_ASYNCDNS */

#ifndef FEAT_CMDMON

void
CAM_Initialise(int family)
{
}

void
CAM_Finalise(void)
{
}

void
CAM_OpenUnixSocket(void)
{
}

int
CAM_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
{
  return 1;
}

void
MNL_Initialise(void)
{
}

void
MNL_Finalise(void)
{
}

#endif /* !FEAT_CMDMON */

#ifndef FEAT_NTP

void
NCR_AddBroadcastDestination(IPAddr *addr, unsigned short port, int interval)
{
}

void
NCR_Initialise(void)
{
}

void
NCR_Finalise(void)
{
}

int
NCR_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
{
  return 1;
}

int
NCR_CheckAccessRestriction(IPAddr *ip_addr)
{
  return 0;
}

void
NIO_Initialise(int family)
{
}

void
NIO_Finalise(void)
{
}

void
NSR_Initialise(void)
{
}

void
NSR_Finalise(void)
{
}

NSR_Status
NSR_AddSource(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourceParameters *params)
{
  return NSR_TooManySources;
}

void
NSR_AddSourceByName(char *name, int port, int pool, NTP_Source_Type type, SourceParameters *params)
{
}

NSR_Status
NSR_RemoveSource(NTP_Remote_Address *remote_addr)
{
  return NSR_NoSuchSource;
}

void
NSR_RemoveAllSources(void)
{
}

void
NSR_HandleBadSource(IPAddr *address)
{
}

void
NSR_RefreshAddresses(void)
{
}

void
NSR_SetSourceResolvingEndHandler(NSR_SourceResolvingEndHandler handler)
{
  if (handler)
    (handler)();
}

void
NSR_ResolveSources(void)
{
}

void NSR_StartSources(void)
{
}

void NSR_AutoStartSources(void)
{
}

int
NSR_InitiateSampleBurst(int n_good_samples, int n_total_samples,
                        IPAddr *mask, IPAddr *address)
{
  return 0;
}

uint32_t
NSR_GetLocalRefid(IPAddr *address)
{
  return 0;
}

int
NSR_TakeSourcesOnline(IPAddr *mask, IPAddr *address)
{
  return 0;
}

int
NSR_TakeSourcesOffline(IPAddr *mask, IPAddr *address)
{
  return 0;
}

int
NSR_ModifyMinpoll(IPAddr *address, int new_minpoll)
{
  return 0;
}

int
NSR_ModifyMaxpoll(IPAddr *address, int new_maxpoll)
{
  return 0;
}

int
NSR_ModifyMaxdelay(IPAddr *address, double new_max_delay)
{
  return 0;
}

int
NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio)
{
  return 0;
}

int
NSR_ModifyMaxdelaydevratio(IPAddr *address, double new_max_delay_dev_ratio)
{
  return 0;
}

int
NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum)
{
  return 0;
}

int
NSR_ModifyPolltarget(IPAddr *address, int new_poll_target)
{
  return 0;
}

void
NSR_ReportSource(RPT_SourceReport *report, struct timespec *now)
{
  memset(report, 0, sizeof (*report));
}
  
int
NSR_GetNTPReport(RPT_NTPReport *report)
{
  return 0;
}

void
NSR_GetActivityReport(RPT_ActivityReport *report)
{
  memset(report, 0, sizeof (*report));
}

#ifndef FEAT_CMDMON

void
CLG_Initialise(void)
{
}

void
CLG_Finalise(void)
{
}

void
DNS_SetAddressFamily(int family)
{
}

DNS_Status
DNS_Name2IPAddress(const char *name, IPAddr *ip_addrs, int max_addrs)
{
  return DNS_Failure;
}

void
KEY_Initialise(void)
{
}

void
KEY_Finalise(void)
{
}

#endif /* !FEAT_CMDMON */
#endif /* !FEAT_NTP */

#ifndef FEAT_REFCLOCK
void
RCL_Initialise(void)
{
}

void
RCL_Finalise(void)
{
}

int
RCL_AddRefclock(RefclockParameters *params)
{
  return 0;
}

void
RCL_StartRefclocks(void)
{
}

void
RCL_ReportSource(RPT_SourceReport *report, struct timespec *now)
{
  memset(report, 0, sizeof (*report));
}

#endif /* !FEAT_REFCLOCK */

#ifndef FEAT_SIGND

void
NSD_Initialise(void)
{
}

void
NSD_Finalise(void)
{
}

int
NSD_GetAuthDelay(uint32_t key_id)
{
  return 0;
}

int
NSD_SignAndSendPacket(uint32_t key_id, NTP_Packet *packet, NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr, int length)
{
  return 0;
}

#endif /* !FEAT_SIGND */