doc/manual/source/new-modules.rst
changeset 7197 b55a5876af9a
parent 7163 a8d7b6569add
child 7275 83f76a2f8449
equal deleted inserted replaced
7195:316d93dd9375 7197:b55a5876af9a
    34                         examples-to-run.py
    34                         examples-to-run.py
    35                 wscript
    35                 wscript
    36 
    36 
    37 Not all directories will be present in each module.
    37 Not all directories will be present in each module.
    38 
    38 
    39 Step 2 - Copy the template module
    39 Step 2 - Create your new module based on the template module
    40 *********************************
    40 ************************************************************
    41 
    41 
    42 The template module ::
    42 The template module ::
    43 
    43 
    44   src/template
    44   src/template
    45 
    45 
    53 
    53 
    54   src/new-module/wscript
    54   src/new-module/wscript
    55 
    55 
    56 and replace all of the occurrences of "template" in this wscript file with the name of your new module, i.e. "new-module" for our assumed module name.
    56 and replace all of the occurrences of "template" in this wscript file with the name of your new module, i.e. "new-module" for our assumed module name.
    57 
    57 
       
    58 You will also need to specify the |ns3| modules your new module will
       
    59 depend on.  Let's assume that "new-module" depends on the internet,
       
    60 mobility, and aodv modules.  Then the call to the function that will
       
    61 create this module should look like this when you are done with this
       
    62 step: ::
       
    63 
       
    64     module = bld.create_ns3_module('new-module', ['internet', 'mobility', 'aodv'])
       
    65 
       
    66 As an example, the dependencies for the spectrum module are specified
       
    67 in ::
       
    68 
       
    69   src/spectrum/wscript
       
    70 
       
    71 with the following function call: ::
       
    72 
       
    73     module = bld.create_ns3_module('spectrum', ['internet', 'propagation',
       
    74         'applications'])
       
    75 
    58 If your module will have model source files, then create the following directory where they will go: :: 
    76 If your module will have model source files, then create the following directory where they will go: :: 
    59 
    77 
    60   mkdir src/new-module/model
    78   mkdir src/new-module/model
    61 
    79 
    62 Copy all of your module's model source files to the above directory.
    80 Copy all of your module's model source files to the above directory.
    64 If your module will have helper source files, then create the following directory where they will go: :: 
    82 If your module will have helper source files, then create the following directory where they will go: :: 
    65 
    83 
    66   mkdir src/new-module/helper
    84   mkdir src/new-module/helper
    67 
    85 
    68 Copy all of your module's helper source files to the above directory.
    86 Copy all of your module's helper source files to the above directory.
       
    87 
       
    88 If your module will have tests, then copy all of your module's test files to the following directory: :: 
       
    89 
       
    90   mkdir src/new-module/test
       
    91 
    69 
    92 
    70 Step 3 - Specify your module's source files
    93 Step 3 - Specify your module's source files
    71 *******************************************
    94 *******************************************
    72 
    95 
    73 If your new module has model and/or helper source files, then they
    96 If your new module has model and/or helper source files, then they
    80 As an example, the source files for the spectrum module are specified
   103 As an example, the source files for the spectrum module are specified
    81 in ::
   104 in ::
    82 
   105 
    83   src/spectrum/wscript
   106   src/spectrum/wscript
    84 
   107 
    85 with the following function call and list
   108 with the following list of source files: ::
    86 of source files.  Note that the second argument for the function
       
    87 create_ns3_module() is the list of modules that the module being created
       
    88 depends on: ::
       
    89 
       
    90     module = bld.create_ns3_module('spectrum', ['internet', 'propagation',
       
    91         'applications'])
       
    92 
   109 
    93     module.source = [
   110     module.source = [
    94         'model/spectrum-model.cc',
   111         'model/spectrum-model.cc',
    95         'model/spectrum-value.cc',
   112         'model/spectrum-value.cc',
    96                .
   113                .
   262 
   279 
   263     ("realtime-udp-echo.py", "ENABLE_REAL_TIME == False"),
   280     ("realtime-udp-echo.py", "ENABLE_REAL_TIME == False"),
   264 
   281 
   265 
   282 
   266 Step 8 - Add your module to the list on |ns3| modules
   283 Step 8 - Add your module to the list on |ns3| modules
   267 ****************************************************
   284 *****************************************************
   268 
   285 
   269 Your new module must be added to the current list of |ns3| modules by modifying the following wscript file with your text editor: ::
   286 Your new module must be added to the current list of |ns3| modules by modifying the following wscript file with your text editor: ::
   270 
   287 
   271   src/wscript
   288   src/wscript
   272 
   289