[OpenSIPS-Devel] [OpenSIPS/opensips] d6780d: DEV-1 (Pluggable Preprocessor): Prepare code layout

Liviu Chircu noreply at github.com
Thu Feb 21 12:57:53 EST 2019


  Branch: refs/heads/feature/pluggable-preprocessor
  Home:   https://github.com/OpenSIPS/opensips
  Commit: d6780db16e43086cc4f5220f2c2a50f77f16bfbf
      https://github.com/OpenSIPS/opensips/commit/d6780db16e43086cc4f5220f2c2a50f77f16bfbf
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2019-02-21 (Thu, 21 Feb 2019)

  Changed paths:
    A cfg.c
    A cfg.h
    M help_msg.h
    M main.c

  Log Message:
  -----------
  DEV-1 (Pluggable Preprocessor): Prepare code layout

    * add/document new "-p" (preprocessor) cmdline option
    * hook the new "-p" option into the parsing code
    * re-organize cfg file managing code into a separate file


  Commit: e83904d75666eca38dbb0f16350e7531d5c76d4e
      https://github.com/OpenSIPS/opensips/commit/e83904d75666eca38dbb0f16350e7531d5c76d4e
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2019-02-21 (Thu, 21 Feb 2019)

  Changed paths:
    M cfg.c
    M main.c

  Log Message:
  -----------
  DEV-1: Implement config file flattening + adnotations

The main idea is to be able to feed the preprocessor with a contiguous
stream of input.  The consequence of doing this is that we must
pre-resolve all "include_file" statements by creating one large cfg
file, in a process called "flattening".

Example of flattening + adnotation:

------ cfg/opensips-3.0-preproc-1.cfg ------
log_level = 4
log_stderror = yes

include_file "cfg/opensips-3.0-preproc-2.cfg"
loadmodule "tm.so"
include_file "cfg/opensips-3.0-preproc-4.cfg"
loadmodule "dialog.so"

------ cfg/opensips-3.0-preproc-2.cfg ------
listen = udp:*:5060
include_file "cfg/opensips-3.0-preproc-3.cfg"

------ cfg/opensips-3.0-preproc-3.cfg ------
mpath = "modules/"
loadmodule "proto_udp.so"

------ cfg/opensips-3.0-preproc-4.cfg ------
loadmodule "usrloc.so"

These four files with nested includes will be flattened into this beast:
---------------------------------------------------
__OSSPP_FILEBEGIN__ "cfg/opensips-3.0-preproc-1.cfg"
__OSSPP_LINE__ 1
log_level = 4
__OSSPP_LINE__ 2
log_stderror = yes
__OSSPP_LINE__ 3

__OSSPP_LINE__ 4
__OSSPP_FILEBEGIN__ "cfg/opensips-3.0-preproc-2.cfg"
__OSSPP_LINE__ 1
listen = udp:*:5060
__OSSPP_LINE__ 2
__OSSPP_FILEBEGIN__ "cfg/opensips-3.0-preproc-3.cfg"
__OSSPP_LINE__ 1
mpath = "modules/"
__OSSPP_LINE__ 2
loadmodule "proto_udp.so"
__OSSPP_FILEEND__
__OSSPP_FILEEND__
__OSSPP_LINE__ 5
loadmodule "tm.so"
__OSSPP_LINE__ 6
__OSSPP_FILEBEGIN__ "cfg/opensips-3.0-preproc-4.cfg"
__OSSPP_LINE__ 1
loadmodule "usrloc.so"
__OSSPP_FILEEND__
__OSSPP_LINE__ 7
loadmodule "dialog.so"
__OSSPP_FILEEND__
---------------------------------------------------


Compare: https://github.com/OpenSIPS/opensips/compare/d6780db16e43%5E...e83904d75666



More information about the Devel mailing list