r1 - 2010-07-09 - 20:15:24 - LinusKarlssonYou are here: NTP >  Dev Web > GoogleSummerOfCode > GSoC2010UnitTesting > NtpdFunctionMap
NTP users are strongly urged to take immediate action to ensure that their NTP daemons are not susceptible to being used in distributed denial-of-service (DDoS) attacks. Please also take this opportunity to defeat denial-of-service attacks by implementing Ingress and Egress filtering through BCP38.

ntp-4.2.8p15 was released on 23 June 2020. It addresses 1 medium-severity security issue in ntpd, and provides 13 non-security bugfixes over 4.2.8p13.

Please see the NTP Security Notice for vulnerability and mitigation details.

Are you using Autokey in production? If so, please contact Harlan - he's got some questions for you.

Ntpd Function Map

This page contains testing notes about ntpd. For every function I have a list of functions it calls. This is important since we don't want tests for a function to depend on others.



  • init_control(): ctl_clr_stats()
    Initializes variables. Could check that the number of events are reset, and that there are no last event recorded.
  • ctl_error(): authencrypt(), sendpkt()
    Test that the sent error packet looks correct, for different errcodes. Also, packet should look different if authenticated NTP is used or not.
  • save_config(): ctl_putdata(), ctl_flushpkt(), time(), localtime(), strftime(), open(), fdopen(), dump_all_config_trees(), set_sys_var(), fclose()
    Test that saving is prohibited if nomodify flag is set, or if no saveconfig dir is set. Test that a filename with path separator ( / or \ ) is rejected. Test that the written filename can be retrieved as a system variable (rv 0 savedconfig)
  • process_control(): ctl_error(), authistrusted(), authdecrypt()
    Test that a packet with illegal version is rejected. Verify that a opcode requiring authentication only calls the cc-handler if authentication is ok. Test that an invalid opcode gives an error.
  • ctlpeerstatus():
    Test various combinations of flags, and see that the returned status matches.
  • ctlclkstatus():
    (#ifdef REFCLOCK) Test that returned status matches a the lastevent and current status of the sent in refclock.
  • ctlsysstatus():
    A status word containing the current clock sync'd to, the number of events an the last event. Could be tested when we know the value of these static variables, e.g after a init_control() call.
  • ctl_flushpkt(): sendpkt(), authencrypt()
    Test that the sent packet is padded to 32-bit multiple. I am not sure how async works, it should probably be tested though.. Test that an authenticated packet looks correct, and also test that a regular packet looks ok.
  • ctl_putdata(): ctl_flushpkt()
    Test with both non-binary and binary data. Test that ascii-data are "padded" with \r\n when exceeding MAXDATALINELEN. Ensure that binary data are not padded. If the data cannot be fit in the current package, flush it and put it in a new one. Test by filling a "current" package with junk, then try to put some new data in it (that's too large).
  • ctl_putstr(): ctl_putdata()
    Fake ctl_putdata(), and check that the generated buffer is correct. Test standard => tag="data" Test empty data => tag
  • ctl_putunqstr(): ctl_putdata()
    Exactly like ctl_putstr(), but without the quotes.
  • ctl_putdbl(): ctl_putdata()
    Test with both positive and negative double, should get something like tag=0.123 (three decimal places).
  • ctl_putuint(): ctl_putdata()
    Test with single unsigned long, tag=123
  • ctl_putfs(): ctl_putdata(), gmtime()
    Test that a timestamp is returned on the form: tag=201007082354, for 2010-07-08 23:54Z
  • ctl_puthex(): ctl_putdata()
    Test that a u_long is printed in hex.
  • ctl_putint(): ctl_putdata()
    Test both with positive and negative ints.
  • ctl_putts(): ctl_putdata()
    Test with a l_fp value, just print it out like tag=12341234.12341234 (in hex)
  • ctl_putadr(): ctl_putdata()
    Test both with addr set to NULL, and to a real sockaddr_u. If addr = NULL, the string should just be the IP-addr in regular format (tag= If addr NULL, the whole socket should be converted into a string with ntoa().
  • ctl_putid(): ctl_putdata()
    Prints a tag like tag=abcd, but with maxiumum 4 chars as data. Test both with <4 chars, and with >4 chars.
  • ctl_putarray(): ctl_putdata()
    Test with different starting points.
  • ctl_putsys(): ctl_putuint(), ctl_putint(), ctl_putdbl(), ctl_putdata(), and other ctl_put*()
    Test with different varid (there are a lot). Most of them only calls ctl_putuint() The most interesting one is CS_VARLIST. Test this by having a variable amount of system variables, and check that the output is something like tag="var1,var2,var3"
  • ctl_putpeer(): ctl_put*(), EVP_get_digestbynid(), OBJ_nid2ln()
    Test like ctl_putsys(), again, CP_VARLIST is the interesting one.
  • ctl_putclock(): ctl_put*()
    See ctl_putpeer(), ctl_putsys()
  • ctl_getitem(): ctl_error()
    Test with both empty tags, and tags with data (tag and tag=data). Also test multiple data items.
  • control_unspec(): findpeerbyassoc(), ctl_error(), ctlpeerstatus(), ctlsysstatus(), ctl_flushpkt()
    Test that an error is returned if the there is a association, but no corresponding peer.
  • read_status(): findpeerbyassoc(), ctl_error(), ctl_putpeer(), ctl_flushpkt(), ctlpeerstatus(), ctl_putdata()
    Test both that case where we should return a specific peer's status, and the case where we should return all peer's statuses.
  • read_peervars(): findpeerbyassoc(), ctl_error(), ctl_getitem(), ctl_putpeer(), ctl_flushpkt()
    Test that the generated packet works for peers with no, one, and many variables.
  • read_sysvars(): ctlsysstatus(), ctl_getitem(), ctl_error(), ctl_putsys(), ctl_putdata(), ctl_flushpkt()
    Test both none, single and multiple requested sys. vars.
  • read_variables(): read_peervars(), read_sysvars()
    Just a wrapper
  • write_variables(): ctl_error(), ctl_getitem(), set_sys_var(), ctl_flushpkt()
    Test that writing to a peer is always refused. Test
  • configure(): ctl_error(), ctl_putdata(), ctl_flushpkt(), config_remotely()
    Test that configuration is rejected if nomodify is set. Calls config_remotely() to do the rest of the work.
  • derive_nonce(): ntp_random(), EVP_Digest_Init(), EVP_DigestUpdate(), EVP_DigestFinal()
    Test that a correct nonce is generated (salt should be predefined to avoid ntp_random())
  • generate_nonce(): derive_nonce()
    Test that generated nonce is outputted to nonce. Tests for this function should most likely be combined with derive_nonce().
  • validate_nonce(): derive_nonce(), get_systime()
    Take the current system time, test that the generated nonce is validated ok. Test that if the time diff is >15 seconds, the validation will fail.
  • send_mru_entry(): ntp_random(), ctl_putunqstr(), ctl_putts(), ctl_putint(), ctl_putuint(), ctl_puthex()
    Entries are send in random order, so tests would have to fake ntp_random(). Apart from that, just see that the packet generated contains the values in mon.
  • send_random_tag_value(): ntp_random(), ctl_putuint()
    Need to fake ntp_random(). Test that generated string is on form: aaa.5=1234;
  • read_mru_list(): set_var(), ctl_getitem(), decodenetnum(), getinterface(), free_varlist(), validate_nonce(), ctl_error(), ctl_putts(), ctl_putunqstr(), get_systime(), generate_nounce(), send_mru_entry(), send_random_tag_value(), ctl_flushpkt()
  • send_ifstats_entry(): ntp_random(), ctl_putunqstr(), ctl_putint(), ctl_putstr(), ctl_puthex(), ctl_putuint(), send_random_tag_value()
    Sends 12 variables from the struct interface argument. Tests needs to fake ntp_random() so that entries are added in a determined order.
  • read_ifstats(): send_ifstats_entry(), ctl_flushpkt()
    Calls send_ifstats_entry() for every interface, then calls ctl_flushpkt(). Test that every interface is sent.
  • req_nonce(): generate_nonce(), ctl_putunqstr(), ctl_flushpkt()
    Test that a packet with a nonce= is generated.
  • read_clockstatus(): ctl_error(), findpeerbyassoc(), refclock_control(), ctl_getitem(), free_varlist(), ctl_putclock(), ctl_putdata(), ctl_flushpkt()
    Test that only clock peers are returned, by having a peer list with no refclocks. The sent packet should be a "CERR_BADASSOC".
  • write_clockstatus(): ctl_error()
    Always fail with CERR_PERMISSION.
  • set_trap(): ctl_error(), ctlsettrap(), ctl_flushpkt()
    Test that configuration is rejected if notrap is set. If ctlsettrap() fails, a CERR_NORESOURCE packet should be sent.
  • unset_trap(): ctlclrtrap(), ctl_error(), ctl_flushpkt()
    Not sure about what RES_LPTRAP means. If ctlclrtrap() fails, a CERR_BADASSOC packet should be sent.
  • ctlsettrap(): ctlfindtrap()
    Test that an already existing trap gets updated. Test that old traps (INUSE && CONFIGURED && time expired) are cleared out (when adding a new trap) Test that a new trap is added if there's place. Test that function returns 0 if full.
  • ctlclrtrap(): ctlfindtrap()
    Test that function returns 0 if it's not found.
  • ctlfindtrap():
    Test that an existing trap is found, and if no such trap exist, NULL is returned.
  • report_event(): ctlsysstatus(), eventstr(), refnumtoa(), stlpeerstatus(), eventstr(), record_proto_stats(), ctl_putsys(), ctl_putpeer(), refclock_control(), ctl_puthex(), ctlclkstatus(), ctl_putclock(), ctl_putdata(), free_varlist(), ctl_flushpkt()
    Test that if the last CTL_SYS_MAXEVENTS have been the same error type, the event should be ignored. If the peer argument is NULL, the sysstatus should be sent, instead of peerstatus.
  • ctl_clr_stats():
    Just sets a bunch of variables to zero. ctltimereset is set to the current time.
  • count_var():
    Returns the number of variables in a ctl_var* chain. Test that i works for an empty (NULL) list.
  • add_var(): count_var()
    Test that a new ctl_var is added to the end of the chain, with no modification to the other vars. Also check that the terminating {0, NULL, EOV} is in place.
  • set_var(): add_var()
    Test that an already existing variable, with defined data can be changed (both if the current data length is smaller or larger than the new length). Test that an already existing variable, without data (NULL) can get new data. Test that a non-existant variable gets added.
  • set_sys_var(): set_var()
    Only calls set_var() with a predefined ctl_var*-list
  • free_varlist():
    Should test that all memory is freed, all variables + their data. Not sure how to check this though.


  • session_key(): EVP_* calls, MD5auth_setkey(), authtrust()
    Test that the generated hash fulfils the description in function comment (hash of source addr, destination addr keyID and a private value.) Test that the returned keyid is the four first bytes of this MD5 hash. Test that the key is stored in authkeys, if the supplied lifetime > 0.
  • make_keylist(): crypto_time(), ntp_random(), authhavekey(), session_key(), auth_havekey(), EVP_* functions.
    Test that a list with size <= NTP_MAXSESSION is generated. And that all keys in this list is unique. Test that if the peer is in broadcast mode (peer->hmode == MODE_BROADCAST), the generated session should be based on zero (0) as private value. Test that the last generated keyid is saved in the peer->sndval struct.
  • crypto_recv(): EVP_get_digestbynid(), RAND_bytes(), OBJ_nid2ln(), record_crypto_stats(), crypto_verify(), cert_install(), cert_hike(), d2i_X509(), X509_free(), X509_get_pubkey(), crypto_iff(), crypto_gq(), crypto_mv(), EVP_PKEY_size(), crypto_update(), report_event()
  • crypto_xmit(): crypto_time(), crypto_send(), crypto_alice(), crypto_bob(), crypto_alice2(), crypto_bob2(), crypto_alice3(), crypto_bob3(), cert_sign(), value_free(), crypto_encrypt(), findpeerbyassoc()
  • crypto_verify(): EVP_VerifyInit(), EVP_VerifyUpdate(), EVP_VerifyFinal(), EVP_PKEY_size()
    Test the error cases, that would be: protocol, length, timestamp and filestamp.
  • crypto_encrypt(): d2i_PublicKey(), ERR_error_string(), ERR_get_error(), RSA_public_encrypt(), EVP_PKEY_free(), EVP_SignInit(), EVP_SignUpdate(), EVP_SignFinal()
    Test that an invalid package (without public key) will yield a XEVNT_PUB. Test that a timestamp of 0 will bypass the signing
  • crypto_ident(): crypto_key()
    Test by passing a peer with different crypto flags set. Test that a peer with no crypto flags returns CRYPTO_NULL.
  • crypto_args(): crypto_time()
    Test by sending in the known peer, opcode, associd and (optional) a string. Verify that the extension returned looks ok. Depends on the current timestamp. Don't forget to free the returned structure.
  • crypto_send():
    Test that the value is padded correctly with zeroes, that the timestamps are copied from value to extension pointer.
  • crypto_update(): crypto_time(), EVP_Sign*(), record_crypto_stats()
    The hostval should get a new timestamp, the public key should get a new signature. All certifications in the cinfo chain should get new signatures.
  • value_free():
    free:s and zeroes everything in the supplied vp pointer..
  • crypto_time(): get_systime()
    Test that function returns zero if time is not synchronized.
  • asn2ntp(): timegm()
    Test by sending a ASN.1 structure in, and expect a ntp-time-u_long out.
  • bighash(): EVP_bn2bin(), EVP_bin2bn, EVP_Digest*()
    Test that the generated BIGNUM is a MD5-hash.
  • Implementation of the various crypto algorithm follows. They should also be tested, preferably by someone who knows how they work.


  • debug_create_priority_queue():
    Not sure if debug functions should be tested, anyhow, test by checking that front of queue is null, and the number of elements is zero.
  • destroy_queue():
    Should free all items in the queue. Not sure how to check if memory is freed though.
  • debug_get_node():
    Creates a new empty node, together with an extra byte.. Test that node_next is NULL.
  • free_node():
    Verify that the memory (including the extra bookkeeping byte is freed).
  • next_node():
    Test that the function returns a pointer the next node in a list (or NULL if there are no more nodes).
  • empty():
    Test that a NULL pointer aswell as a queue with no front element is empty.
  • queue_head():
    Test that it returns the front element, or NULL if the queue is empty or NULL.
  • enqueue():
    Test that the item is placed correcly with regard to the priority function of the queue. Test with empty, single and multiple items in the queue. Ensure that the element count is incresed.
  • dequeue():
    Test that the first element is removed (if there is such an element). Return the removed element, or NULL if there were no element left.
  • get_no_of_element():
    Just returns the no_of_elements field of the queue.
  • append_queue():
    Test with two different queues, and ensure that they get merged correctly with a real priority function.


  • filegen_init():
    Just sets initial values.
  • filegen_uninit():
    Frees basename in FILEGEN struct.
  • filegen_open(): caljulian(), stat(), rename(), unlink(), delete(), fopen(), fclose(), SetLastError()
    Test that the generated filename is OK (there are several options, like pid, day, month, year, age, week). Test that if such file already exists, it should be removed. And then a new file should be created.
  • filegen_setup(): fclose(), getpid(), caljulian(), caltontp(), calyearstart(), filegen_open()
    Generates an integer depending on what filename to generate in filegen_open() (pid, day and so on). Calls filegen_open with this. Tests for this function should probably be merge with filegen_open().
  • filegen_config(): valid_fileref(), fclose(), get_systime(), filegen_setup()
    Test that a invalid basename (e.g contains path sep.) is rejected. Test that FILEGEN is updated even if the file is currently opened.
  • valid_fileref():
    Test that an empty prefix is rejected. Test that an undefined basename is rejected. Test that basenames containing ".." are rejected.
  • filegen_get():
    Test that a FILEGEN with the name is returned if it exists (otherwise return null)
  • filegen_register(): filegen_init()
    Adds a new filegen to the list, test that an already existing item is overwritten. Test that a new item is added to the end.
  • filegen_unregister(): filegen_uninit()
    Test that an existing item is unlinked from the list.


  • Threads...



  • init_mon():
  • remove_from_hash(): UNLINK_SLIST()
    Test that the supplied entry is removed from the mru_list.
  • mon_free_entry(): LINK_SLIST()
    Check that the entry is added to the list of free entries, and that it's zeroed out.
  • mon_reclaim_entry(): UNLINK_DLIST()
    Test that the entry is removed from mru list and hash map.
  • mon_getmoremem():
    Test that the number of free entries are increased by mry_incalloc.
  • mon_start(): mon_getmoremem()
    Allocates memory.. Not much to test.
    Sets the status to MON_OFF, and adds free entries to free list.
  • mon_clearinterface(): ITER_DLIST_BEGIN(), ITER_DLIST_END()
    Test that all elements matching lcladr is removed from hash list and mru list.
  • ntp_monitor(): UNLINK_DLIST(), LINK_DLIST(), UNLINK_HEAD_SLIST(), TAIL_DLIST(), mon_getmoremem(), mon_reclaim_entry(), ntp_random(), LINK_SLIST()
    Test that the newly updated/added entry gets to the top in the MRU list. Test that statistics are update if an entry already exists.






  • init_restrict(): LINK_SLIST macros.
    Adds base entries matching all entries.
  • alloc_res4():
    alloc_res6(): UNLINK_HEAD_SLIST, LINK_SLIST.
    Should return a free structure if available, otherwise allocate new memory and append to the free list.
  • free_res(): UNLINK_SLIST, LINK_SLIST
    Should reset a structure, and put it in the list of free structures.
  • inc_res_limited(): mon_start()
    Should call mon_start() if ref. count is > 0.
  • dec_res_limited(): mon_stop()
    Should call mon_stop if ref. count is 0.
  • match_restrict4_addr(): match_restrict6_addr(): free_res()
    Should return the closest matching mask, test with IPv4 and IPv6 adresses. Check that every addresses gets a match, there shall be a that are the default restrictions.
  • match_restrict_entry():
    Should only return an exact match (in terms of addr, mask and flags). Test that equal items are found and returned, and that NULL is returned otherwise.
  • res_sorts_before4():
  • res_sorts_before6(): ADDR6_CMP (for IPv6 version)
    Returns true if r1 should be before r2 in a sorted list. Test with IPv4 and IPv6 addresses, and verify that sorting is done correctly (compare first addresses, if equal compare their masks, and last flags).
  • restrictions(): match_restrict4_addr(), match_restrict6_addr()
    Test that default restrictions apply, that stored rules are matched, and that multicast sources are ignored.
  • hack_restrict(): match_restrict_entry(), alloc_res6(), alloc_res4(), LINK_SORT_SLIST(), inc_res_limited(), dec_res_limited(), free_res()
    Test adding flags to already existing entries, and adding new entries. Test remove flags from existing entries (both in case where flag is set, and when it's not set). Also test removal of an entry completely.
  • restrict_source(): hack_restrict(), match_restrict{4,6}_addr(), free_res()
    Test by sending in a real address, and check that restrictions apply, and then remove it again.


  • ux_socket_connect(): socket(), connect(), close()
    Connects to socket given a name, returns file descriptor. Does not know how to test.
  • write_all(): write()
    Writes data with write(), until write() fails or has sent everything. Test that the the total amount of data written is correct when everything should be correct...
  • read_all(): read()
    Reads until the given length is read, or when a failure occurs.

  • send_packet(): write_all()
    Returns 0 if a packet was sent, -1 otherwise. Only call write_all really..
  • recv_packet(): read_all()
    Calls read_all to read from socket.

  • send_via_ntp_signd(): ux_socket_connect(), send_packet(), recv_packet(), sendpkt(), close()
    Sends a package to Samba, test that the send in package is sent to the socket, and that the reply is received and stored.


  • reinit_timer(): timer_gettime(), timer_settime(), getitimer(), setitimer().
  • init_timer(): timer_create(), timer_settime(), setitimer(), lib$emul(), sys$gettim(), lib$addx(), sys$setimr(), CreateWaitableTimer(), SetWaitableTimer()
    init functions that initializes the timers, calls different init functions depending on platform. Don't know how to test.
  • get_timer_handle():
    Only on Windows, just returns a handle.
  • timer(): adj_host_clock(), refclock_timer(), refclock_transmit(), transmit(), step_systime(), report_event(), huffpuff(), auth_agekeys(), timer_interfacetimeout(), interface_update(), write_stats(), get_systime()
  • alarming(): lib$addx(), sys$setimr()
    Sets the alarm_flag variable, check so that it's set after calling it (and still set when calling it again).
  • timer_interfacetimeout():
    Just sets a variable.
  • timer_clr_stats():
    Sets a couple of variables to defaults.


  • init_util(): filegen_register()
    Check that variables are initialized correctly (peerstats, and similar).
  • write_stats(): getpriority(), setpriority(), getclock(), ntp_set_tod(), record_sys_stats(), fopen(), _unlink(), rename(), lib$delete_file()
    Writes the drift file
  • stats_config(): ExpandEnvironmentStrings(), fopen(), fclose()
    Test the different cases, read from drift file, change of stat directory (test with/without trailing dir. separator), read from {PID,leapsecond} file.
  • record_peer_stats():
    record_timing_stats(): get_systime(), filegen_setup()
    Test that file is written with some fake data, also test that no file is written when stats_control is false.
  • leap_file(): fgets()
    Reads from file, test that comment lines are ignored. Test that function returns non-zero if file is invalid (does not contain any leapsecs)
  • leap_month():
    Testable! Test both in leap year, and in non-leap year.
  • getauthkeys(): ExpandEnvironmentStrings (), authreadkeys()
    Only a wrapper for authreadkeys() which should be tested in libntp.
  • rereadkeys(): authreadkeys()
    Calls authreadkeys(), if filename is not empty.
  • fstostr(): gmtime()
    Test that a given timestamp is formatted correctly (function uses UTC)
  • ntpd_time_stepped(): mon_stop(), mon_start(), win_time_stepped()
    Check that the MRU list are emptied.


  • queue_blocking_request(): send_blocking_req_internal()
  • queue_blocking_response(): send_blocking_resp_internal()
  • process_blocking_response(): receive_blocking_resp_internal()
  • blocking_child_common(): receive_blocking_req_internal(), blocking_getaddrinfo(), blocking_getnameinfo()


  • exit_worker(): fflush()
  • worker_sighup():
    Just a setter. Sets variable if argument is equal to SIGHUP.
  • worker_sleep(): sleep()
    Test that sleep continues the required time, even if a interrupt is received. The only exception is for sighup, then function should return non-zero.
  • interrupt_worker_sleep(): kill()
  • send_worker_home_atexit(): close()
    Closes a couple of pipes.
  • send_blocking_req_internal(): fork_blocking_child(), write()
    Don't know
  • receive_blocking_req_internal(): read()
    Don't know
  • send_blocking_resp_internal(): write()
    Writes to a pipe..
  • receive_blocking_resp_internal(): read()
    Don't know
  • fork_deferred_worker(): fork_blocking_child()
  • fork_blocking_child(): pipe(), move_fd(), atexit(), fflush(), signal_no_reset(), fork(), update_resp_pipe_fd(), kill_asyncio(), close_all_beyond(), setup_logfile(), init_logging(), exit_worker()
    Test that fork is not done when in root (ifdef HAV_DROPROOT)
  • worker_idle_timer_fired(): close(), update_resp_pipe_fd()
    Zeroes out a couple of variables, check that pipes are closed.


Is this whole file Windows specific? Yes... Methods without comments are just wrappers.

  • exit_worker(): _endthreadex()
    Just a wrapper, just a single call
  • worker_sleep(): WaitForSingleObject()
    Calls WaitForSingleObject() and check if a timeout occured.
  • interrupt_worker_sleep(): Single call to SetEvent()
  • queue_req_point(): WaitForSingleObject()
  • send_blocking_req_internal(): start_blocking_thread(), queue_req_pointer()
    Not much to test.
  • receive_blocking_req_internal(): SetEvent(), WaitForSingleObject(), ResetEvent()
    Test that items are processed in order, and that thread waits when no work is in the queue.
  • send_blocking_resp_internal(): SetEvent()
  • receive_blocking_resp_internal():
  • start_blocking_thread(): CreateEvent(), ResetEvent(), _beginthreadex(), SetThreadPriority(), ResumeThread()
    Initialization routine; creates and resumes a thread.
  • blocking_thread(): blocking_child_common()
    Just a wrapper.
  • working_idle_timer_fired(): queue_req_pointer()



  • getCmdOpts(): proto_config(), stats_config(), OPT_ARG(), authtrust(), HAVE_OPT(), set_sys_var(), optionUsage()
    Tests could be written for every command line option, or to test specific conditions. For example test that ntpd exists if neither IPv4 or IPv6 are found.





  • keyword():
    Returns a text message.

  • F_OPEN(): fopen()
  • FGETC(): fgetc()
  • UNGETC(): ungetc()
  • FCLOSE(): fclose()
    All these are wrapper functions of their C-calls. Test that the extra info is correct (e.g current line and col)

  • get_next_char(): FGETC()
  • push_back_char(): UNGETC()
    Test that both of these can read/write both from char-arrays and from file.

  • is_keyword():
  • is_integer():
  • is_double():
  • is_special():
  • is_EOC():
    Test that these return true/false depending on what the current token is.

  • quote_if_needed():
    Test that a special string is quoted with backslashes, IF there are no surrounding quotes
  • create_string_token():
    Don't know.
  • yylex(): FCLOSE(), push_back_char(), get_next_char(), is_EOC(), is_*()
    Parses a file or string for something i'm not sure about...


  • init_logging(): openlog(), setlogmask()
    Initialization function, nothing to test.
  • change_logfile(): fopen(), fileno()
  • setup_logfile(): change_logfile()
    Invokes change_logfile()
  • parse_cmdline_opts(): optionProcess()
    Makes sure optionProcess is only called once.
  • set_process_priority(): sched_get_priority_max(), sched_get_priority_min(), sched_set_scheduler(), rtprio(), setpriority()
    Calls various setpriority functions depending on platform..
  • ntpdmain(): Calls pretty much everything...
  • assertion_failed(): isc_assertion_setcallback(), isc_assertion_typetotext()
    Logs errors messages with msyslog.
  • library_fatal_error(): isc_error_setfatal()
    Logs error messages with msyslog.
  • library_unexpected_error():
    Logs error messages with msyslog.

-- LinusKarlsson - 2010-07-09

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions...
SSL security by CAcert
Get the CAcert Root Certificate
This site is powered by the TWiki collaboration platform
IPv6 Ready
Copyright & 1999-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding the site? Send feedback