summaryrefslogtreecommitdiff
path: root/cesar/cp2
diff options
context:
space:
mode:
authorlaranjeiro2008-05-05 13:58:54 +0000
committerlaranjeiro2008-05-05 13:58:54 +0000
commitb0a1ceed3d831750e595159779e8782317f95117 (patch)
treeaf8944771288ed857055df1ff404f17d7c3dfd5e /cesar/cp2
parent8fcd387a28d862b25a8da598e6ac79f2d571daaa (diff)
sta_mgr : Added the garbage collector.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1944 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2')
-rw-r--r--cesar/cp2/sta/mgr/doc/sta_manager.odtbin289612 -> 301365 bytes
-rw-r--r--cesar/cp2/sta/mgr/doc/sta_mgr.xmi104
-rw-r--r--cesar/cp2/sta/mgr/inc/net.h11
-rw-r--r--cesar/cp2/sta/mgr/net.h40
-rw-r--r--cesar/cp2/sta/mgr/src/net.c172
-rw-r--r--cesar/cp2/sta/mgr/src/net_list.c11
-rw-r--r--cesar/cp2/sta/mgr/src/sta_mgr.c7
-rw-r--r--cesar/cp2/sta/mgr/sta.h3
-rw-r--r--cesar/cp2/sta/mgr/test/Makefile6
-rw-r--r--cesar/cp2/sta/mgr/test/doc/net.txt34
-rw-r--r--cesar/cp2/sta/mgr/test/src/net_test.c95
-rw-r--r--cesar/cp2/sta/mgr/test/src/station_test.c4
12 files changed, 414 insertions, 73 deletions
diff --git a/cesar/cp2/sta/mgr/doc/sta_manager.odt b/cesar/cp2/sta/mgr/doc/sta_manager.odt
index 17aa9a4d57..045805b59e 100644
--- a/cesar/cp2/sta/mgr/doc/sta_manager.odt
+++ b/cesar/cp2/sta/mgr/doc/sta_manager.odt
Binary files differ
diff --git a/cesar/cp2/sta/mgr/doc/sta_mgr.xmi b/cesar/cp2/sta/mgr/doc/sta_mgr.xmi
index 433714532b..f556facc93 100644
--- a/cesar/cp2/sta/mgr/doc/sta_mgr.xmi
+++ b/cesar/cp2/sta/mgr/doc/sta_mgr.xmi
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-04-30T16:18:56" xmi.version="1.2" >
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-05-05T14:00:34" xmi.version="1.2" >
<XMI.header>
<XMI.documentation>
<XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
@@ -53,32 +53,32 @@
</UML:Package>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="akZjN8x9HKW4" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="F8UbZm4i3kDh" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="k6fn8ewhiA80" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ac6jLXy0tRQo" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0eDGhIiH2HyN" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="NuWfE0hT9B3i" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="xCfdxnyhtbSz" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="FPevXmt7Mzog" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="w7PzpcgqGt6y" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9oD93AWR406I" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="UngLE6ABGnnD" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="altRKLOai2VF" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="0nj7wmossDrh" aggregation="none" type="L2ASUCoHdFZ0" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="nVX1OezVQBeU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="nNK9M9ppwVAA" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZIJo66zeps4A" aggregation="none" type="QCdiA5hU9IAb" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LAvN8zd7kKEg" aggregation="none" type="L2ASUCoHdFZ0" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="70XzDMgysC0E" aggregation="none" type="tftTuiZXSv4R" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="CSiuTB8GYSNt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="bDiVgqdE9x2F" aggregation="none" type="tftTuiZXSv4R" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="rLUcIo7kRV6u" isRoot="false" isAbstract="false" name="Sequence Diagrams" >
@@ -285,7 +285,7 @@
<floatingtext usesdiagramfillcolor="1" width="180" x="151" fillcolor="none" y="126" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="7rUTDckoPF4y" text=": get_our_avln() : cp_net_t *" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</messagewidget>
<messagewidget usesdiagramfillcolor="1" width="409" x="146" fillcolor="none" y="235" operation="LX3kth6enYII" linewidth="none" widgetbid="biKylRDxLL8J" height="32" usefillcolor="1" seqnum="" textid="erTQX8xfzR6A" widgetaid="CuADzIhEejyi" isinstance="0" xmi.id="LX3kth6enYII" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" >
- <floatingtext usesdiagramfillcolor="1" width="142" x="151" fillcolor="none" y="215" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="erTQX8xfzR6A" text=": sta_remove(tei : u8)" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="185" x="151" fillcolor="none" y="215" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="erTQX8xfzR6A" text=": sta_remove_assoc(tei : u8)" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</messagewidget>
<messagewidget usesdiagramfillcolor="1" width="251" x="548" fillcolor="none" y="249" operation="&lt;&lt;relese>>" linewidth="none" widgetbid="dpXFZTxKETTZ" height="8" usefillcolor="1" seqnum="" textid="I0h2DmtZvZsV" widgetaid="biKylRDxLL8J" isinstance="0" xmi.id="hyHvvydcICk1" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" >
<floatingtext usesdiagramfillcolor="1" width="95" x="553" fillcolor="none" y="229" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="I0h2DmtZvZsV" text=": &lt;&lt;relese>>" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
@@ -310,7 +310,7 @@
<floatingtext usesdiagramfillcolor="1" width="180" x="115" fillcolor="none" y="100" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="pZ5Qs0d2SimP" text=": get_our_avln() : cp_net_t *" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</messagewidget>
<messagewidget usesdiagramfillcolor="1" width="389" x="110" fillcolor="none" y="213" operation="LX3kth6enYII" linewidth="none" widgetbid="Z8RjVc3EbLvF" height="32" usefillcolor="1" seqnum="" textid="SMjqXFhMmkke" widgetaid="lzIjgqXrcYR6" isinstance="0" xmi.id="LX3kth6enYII" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" >
- <floatingtext usesdiagramfillcolor="1" width="142" x="115" fillcolor="none" y="193" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="SMjqXFhMmkke" text=": sta_remove(tei : u8)" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="185" x="115" fillcolor="none" y="193" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="SMjqXFhMmkke" text=": sta_remove_assoc(tei : u8)" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</messagewidget>
<messagewidget usesdiagramfillcolor="1" width="200" x="492" fillcolor="none" y="223" operation="&lt;&lt;release>>" linewidth="none" widgetbid="AS7mzWqzZHYC" height="8" usefillcolor="1" seqnum="" textid="s7saKRUmlDcJ" widgetaid="Z8RjVc3EbLvF" isinstance="0" xmi.id="kOfA6PaL0x9s" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" >
<floatingtext usesdiagramfillcolor="1" width="103" x="497" fillcolor="none" y="203" linewidth="none" posttext="" role="704" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="s7saKRUmlDcJ" text=": &lt;&lt;release>>" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
@@ -326,20 +326,20 @@
</UML:Package>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="YPkIkxxpxSo9" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="oS7ee7tS3bhB" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="q43NVOG6bwaI" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mDUv8W88V0xN" aggregation="none" type="QCdiA5hU9IAb" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="xLbSxN6TnomV" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lhKh96qvYvYB" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="vuRFXO2NQ3kv" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Sy03uaJhnlau" aggregation="none" type="QCdiA5hU9IAb" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
<UML:Association.connection>
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1Rd40IDxeoOZ" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
- <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CS2xGmS0Rkha" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Hj2njxAcrasO" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="wsjMwSIOQGPJ" aggregation="none" type="QCdiA5hU9IAb" name="" />
</UML:Association.connection>
</UML:Association>
<UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="cp_sta_mgr_t" >
@@ -486,17 +486,34 @@ Shall update the data bases." isSpecification="false" isLeaf="false" visibility=
<UML:Parameter comment="Indicate if the Station is backup CCo." isSpecification="false" visibility="private" xmi.id="7dzZc6MKvOIF" value="" type="BsXuVmQldfSS" name="backup_cco" />
</UML:BehavioralFeature.parameter>
</UML:Operation>
- <UML:Operation comment="Remove the station from the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LX3kth6enYII" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove" >
+ <UML:Operation comment="Remove the station from the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LX3kth6enYII" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_assoc" >
<UML:BehavioralFeature.parameter>
<UML:Parameter comment="The Station's TEI." isSpecification="false" visibility="private" xmi.id="oWB9No6GmL47" value="" type="nnvOyvzkSE17" name="tei" />
</UML:BehavioralFeature.parameter>
</UML:Operation>
+ <UML:Operation comment="Remove an unassociated station from the list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iG9yQ3L5sqEx" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_unassc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station's mac address." isSpecification="false" visibility="private" xmi.id="AggzfMy1LEO8" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove the station from the net.
+The user shall release the reference." isSpecification="false" isLeaf="false" visibility="public" xmi.id="1mIfdDNMRWIp" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station to remove." isSpecification="false" visibility="private" xmi.id="ZduRT6Nem1bR" value="" type="DcaQZXHCYAUY" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
<UML:Operation comment="Get the station identified by its TEI. returns NULL if the station does not exists. It only returns a new reference on the station (one reference is still kept by the network), when the user does not use it any more, it must release it." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KaVaqfkWnW3C" isRoot="false" isAbstract="false" isQuery="false" name="get_sta" >
<UML:BehavioralFeature.parameter>
<UML:Parameter kind="return" xmi.id="2vS7T8JnioLW" type="DcaQZXHCYAUY" />
<UML:Parameter comment="The station's tei." isSpecification="false" visibility="private" xmi.id="TZF5HQhLblHC" value="" type="nnvOyvzkSE17" name="tei" />
</UML:BehavioralFeature.parameter>
</UML:Operation>
+ <UML:Operation comment="Get an unassociated station identified by its mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KQuOiqL0MaDu" isRoot="false" isAbstract="false" isQuery="false" name="get_sta_unassoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uAueL45fSx3A" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="Unassaociated station's mac address." isSpecification="false" visibility="private" xmi.id="iTllvuA9nkes" value="" type="QPMsbNxuTUYh" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
<UML:Operation comment="Commit the changes of the AVLN. Use to commit the changes in the others databases.
Only call this function when all the stations have been added, or all stations have been removed. This will check the modifications of the network station list to update at least the mactotei table. It is useful to synchronize those tables because the mactotei table does not have the possibility to remove stations it only have the possibility to remove the station by excluding it from the copy to the new one." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2TdT5mMiol3i" isRoot="false" isAbstract="false" isQuery="false" name="commit_to_dataplane" />
<UML:Operation comment="Returns the first station of an AVLN. The user has the responsibility to release the reference on the returned station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="W8rOQJZys2Nh" isRoot="false" isAbstract="false" isQuery="false" name="get_first" >
@@ -580,50 +597,50 @@ The user have the responsibility to release the reference on both stations i.e.
</UML:Namespace.ownedElement>
<XMI.extension xmi.extender="umbrello" >
<diagrams>
- <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="978" snapy="10" showatts="1" xmi.id="bZ62yFKbgidF" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="875" >
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="962" snapy="10" showatts="1" xmi.id="bZ62yFKbgidF" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="938" >
<widgets>
- <classwidget usesdiagramfillcolor="0" width="260" showattsigs="601" x="13" fillcolor="#ffffc0" y="519" showopsigs="601" linewidth="none" height="352" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="tftTuiZXSv4R" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
- <classwidget usesdiagramfillcolor="0" width="740" showattsigs="601" x="15" fillcolor="#ffffc0" y="15" showopsigs="601" linewidth="none" height="400" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
- <classwidget usesdiagramfillcolor="0" width="291" showattsigs="601" x="292" fillcolor="#ffffc0" y="660" showopsigs="601" linewidth="none" height="208" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
- <classwidget usesdiagramfillcolor="0" width="291" showattsigs="601" x="423" fillcolor="#ffffc0" y="448" showopsigs="601" linewidth="none" height="192" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="qIWnFzBd9oKJ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
- <enumwidget usesdiagramfillcolor="0" width="110" x="263" fillcolor="#ffffc0" y="435" linewidth="none" height="80" usefillcolor="1" isinstance="0" xmi.id="pBzpcllJMdsq" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="260" showattsigs="601" x="9" fillcolor="#ffffc0" y="535" showopsigs="601" linewidth="none" height="352" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="tftTuiZXSv4R" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="740" showattsigs="601" x="15" fillcolor="#ffffc0" y="15" showopsigs="601" linewidth="none" height="448" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="291" showattsigs="601" x="296" fillcolor="#ffffc0" y="726" showopsigs="601" linewidth="none" height="208" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="291" showattsigs="601" x="423" fillcolor="#ffffc0" y="501" showopsigs="601" linewidth="none" height="192" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="qIWnFzBd9oKJ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="110" x="277" fillcolor="#ffffc0" y="490" linewidth="none" height="80" usefillcolor="1" isinstance="0" xmi.id="pBzpcllJMdsq" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
</widgets>
<messages/>
<associations>
<assocwidget totalcounta="4" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="tftTuiZXSv4R" widgetaid="QCdiA5hU9IAb" xmi.id="UODsawo5TGgC" type="501" linecolor="none" >
<linepath>
- <startpoint startx="200" starty="415" />
- <endpoint endx="143" endy="519" />
+ <startpoint startx="200" starty="463" />
+ <endpoint endx="139" endy="535" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="16" x="23" fillcolor="none" y="411" linewidth="none" posttext="" role="701" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="ns4KjxDbMWrv" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
- <floatingtext usesdiagramfillcolor="1" width="14" x="123" fillcolor="none" y="481" linewidth="none" posttext="" role="702" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="FZwadzPNcoIs" text="*" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="20" fillcolor="none" y="460" linewidth="none" posttext="" role="701" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="MksyED3J6leT" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="14" x="121" fillcolor="none" y="496" linewidth="none" posttext="" role="702" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="xzKktSgEGgqR" text="*" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="3" indexa="1" totalcountb="4" indexb="2" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="L2ASUCoHdFZ0" xmi.id="c6v3mGeXVqXR" type="512" linecolor="none" >
<linepath>
- <startpoint startx="389" starty="660" />
- <endpoint endx="385" endy="415" />
+ <startpoint startx="393" starty="726" />
+ <endpoint endx="385" endy="463" />
</linepath>
</assocwidget>
<assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="4" indexb="3" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="qIWnFzBd9oKJ" xmi.id="YMFSnX2eMexo" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
- <startpoint startx="568" starty="448" />
- <endpoint endx="570" endy="415" />
+ <startpoint startx="568" starty="501" />
+ <endpoint endx="570" endy="463" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="91" x="468" fillcolor="none" y="417" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="jcXcL0A6qFOX" text="networks [8]" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="91" x="468" fillcolor="none" y="465" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="8eRG4dMQNCPZ" text="networks [8]" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="qIWnFzBd9oKJ" widgetaid="L2ASUCoHdFZ0" xmi.id="5n92zk1smX9k" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
- <startpoint startx="486" starty="660" />
- <endpoint endx="568" endy="640" />
+ <startpoint startx="490" starty="726" />
+ <endpoint endx="568" endy="693" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="88" x="482" fillcolor="none" y="642" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="Ac8W60SLZMuA" text="netwoks_list" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="88" x="482" fillcolor="none" y="695" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="-" isinstance="0" xmi.id="QQtUBVv8UFqL" text="netwoks_list" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
<assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="pBzpcllJMdsq" widgetaid="tftTuiZXSv4R" xmi.id="njbBHkqZRmmB" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
<linepath>
- <startpoint startx="273" starty="695" />
- <endpoint endx="318" endy="515" />
+ <startpoint startx="269" starty="711" />
+ <endpoint endx="332" endy="570" />
</linepath>
- <floatingtext usesdiagramfillcolor="1" width="101" x="225" fillcolor="none" y="517" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="JJVv5mnoOJPi" text="station_state" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="101" x="239" fillcolor="none" y="572" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="gVXwBNMI2nY4" text="station_state" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
</assocwidget>
</associations>
</diagram>
@@ -648,7 +665,7 @@ The user have the responsibility to release the reference on both stations i.e.
</UML:Model>
</XMI.content>
<XMI.extensions xmi.extender="umbrello" >
- <docsettings viewid="bZ62yFKbgidF" documentation="" uniqueid="fWsSFKKyBXEP" />
+ <docsettings viewid="bZ62yFKbgidF" documentation="" uniqueid="ZduRT6Nem1bR" />
<listview>
<listitem open="1" type="800" label="Vues" >
<listitem open="1" type="801" id="Logical View" >
@@ -695,7 +712,10 @@ The user have the responsibility to release the reference on both stations i.e.
<listitem open="0" type="815" id="iaLbV3XXwoul" />
<listitem open="0" type="815" id="Yphrc2Jt91yg" />
<listitem open="0" type="815" id="LX3kth6enYII" />
+ <listitem open="0" type="815" id="iG9yQ3L5sqEx" />
+ <listitem open="0" type="815" id="1mIfdDNMRWIp" />
<listitem open="0" type="815" id="KaVaqfkWnW3C" />
+ <listitem open="0" type="815" id="KQuOiqL0MaDu" />
<listitem open="0" type="815" id="2TdT5mMiol3i" />
<listitem open="0" type="815" id="W8rOQJZys2Nh" />
<listitem open="0" type="815" id="LSNW129OipWM" />
diff --git a/cesar/cp2/sta/mgr/inc/net.h b/cesar/cp2/sta/mgr/inc/net.h
index 487042f359..f6ad53f4fb 100644
--- a/cesar/cp2/sta/mgr/inc/net.h
+++ b/cesar/cp2/sta/mgr/inc/net.h
@@ -27,6 +27,7 @@ enum cp_mactotei_tags_t
CP_MACTOTEI_TAGS_MAX
};
+
struct cp_net_t
{
/** Indicate if it is the station's AVLN. If not the commit to
@@ -82,4 +83,14 @@ cp_net_station_assoc_less (set_node_t *left, set_node_t *right);
bool
cp_net_station_unassoc_less (set_node_t *left, set_node_t *right);
+/**
+ * Garbage function for the unassociated station list and the associated
+ * station list.
+ *
+ * \param ctx the module context.
+ * \param status the station list to expire.
+ */
+void
+cp_net_garbage_station_list (cp_net_t *ctx, enum cp_sta_state_t status);
+
#endif /* cp2_sta_mgr_inc_net */
diff --git a/cesar/cp2/sta/mgr/net.h b/cesar/cp2/sta/mgr/net.h
index a85e9eacf9..5260250147 100644
--- a/cesar/cp2/sta/mgr/net.h
+++ b/cesar/cp2/sta/mgr/net.h
@@ -18,7 +18,6 @@
#include "cp2/cp.h"
#include "cp2/sta/mgr/sta.h"
-
/** Forward declaration. */
typedef struct cp_net_t cp_net_t;
@@ -135,7 +134,26 @@ cp_net_sta_add (cp_net_t *ctx, u8 tei, mac_t mac_address,
* Remove the station from the AVLN.
*/
void
-cp_net_sta_remove (cp_net_t *ctx, u8 tei);
+cp_net_sta_remove_assoc (cp_net_t *ctx, u8 tei);
+
+/**
+ * Remove an unassociated station from the list.
+ * \param ctx the module context.
+ * \param mac_addr The station's mac address.
+ *
+ */
+void
+cp_net_sta_remove_unassc (cp_net_t *ctx, mac_t mac_addr);
+
+/**
+ * Remove the station from the net.
+ * \param ctx the module context.
+ * \param sta The station to remove.
+ *
+ * The user shall release the reference
+ */
+void
+cp_net_sta_remove (cp_net_t *ctx, cp_sta_t * sta);
/**
* Get the station identified by its TEI.
@@ -151,6 +169,19 @@ cp_sta_t *
cp_net_get_sta (cp_net_t *ctx, u8 tei);
/**
+ * Get the unassociated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_unassoc (cp_net_t *ctx, mac_t mac_addr);
+
+/**
* Commit the changes of the AVLN.
* \param ctx the module context.
* \param cp the CP context.
@@ -169,14 +200,15 @@ cp_net_commit_to_dataplane (cp_net_t *ctx, cp_t *cp);
/**
* Returns the first station of an AVLN.
* \param ctx the module context.
- * \param assoc to search in the associated stations or unassociated STAs.
+ * \param status to search in the associated stations or unassociated STAs.
* \return the Station with the minimal TEI for the associated stations, the
* one with the minimal mac address for the unassociated.
*
+ * Returns the first station of an AVLN.
* The user has the responsibility to release the reference.
*/
cp_sta_t *
-cp_net_get_first (cp_net_t *ctx, bool assoc);
+cp_net_get_first (cp_net_t *ctx, enum cp_sta_state_t status);
/**
* Get the next station from the AVLN stating by the previous one already
diff --git a/cesar/cp2/sta/mgr/src/net.c b/cesar/cp2/sta/mgr/src/net.c
index d79741c36b..ca3e9158cc 100644
--- a/cesar/cp2/sta/mgr/src/net.c
+++ b/cesar/cp2/sta/mgr/src/net.c
@@ -16,11 +16,14 @@
#include "lib/blk.h"
#include "cl/cl_mactotei.h"
+#include "mac/common/ntb.h"
#include "cp2/defs.h"
#include "cp2/sta/mgr/net.h"
#include "cp2/sta/mgr/sta.h"
+//#include "cp2/sta/event_handler/station_event_handler.h"
+
#include "cp2/inc/context.h"
#include "cp2/sta/mgr/inc/net.h"
#include "cp2/sta/mgr/inc/sta.h"
@@ -136,13 +139,62 @@ cp_net_uninit (cp_net_t *net)
}
/**
+ * Garbage function for the unassociated station list and the associated
+ * station list.
+ *
+ * \param ctx the module context.
+ * \param status the station list to expire.
+ */
+void
+cp_net_garbage_station_list (cp_net_t *ctx, enum cp_sta_state_t status)
+{
+ cp_sta_t *sta_next;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+
+ if (status >= CP_STA_STATE_MAX)
+ return;
+
+ sta = cp_net_get_first (ctx, status);
+
+ while (sta)
+ {
+ sta_next = cp_net_get_next_sta (ctx, sta);
+
+ if (less_mod2p32(sta->last_seen_ntb + CP_STA_EXPIRATION_DELAY,
+ mac_ntb()))
+ {
+ cp_net_sta_remove (ctx, sta);
+ }
+
+ blk_release (sta);
+ sta = sta_next;
+ }
+}
+
+/**
* Remove old station which has not been seen for a while.
* \param ctx the module context.
*
* Remove old station which has not been seen for a while.
*/
void
-cp_net_garbage_stations (cp_net_t *ctx);
+cp_net_garbage_stations (cp_net_t *ctx)
+{
+ dbg_assert (ctx);
+
+ cp_net_garbage_station_list (ctx, CP_STA_STATE_EXISTS);
+ cp_net_garbage_station_list (ctx, CP_STA_STATE_ASSOCIATED);
+
+ // Verify if the list not empty.
+ if (set_empty (&ctx->associated_stas)
+ && set_empty (&ctx->unassociated_stas))
+ {
+ //TODO Post the event in the FSM.
+ ctx->present = false;
+ }
+}
/**
* Set the CCo or the PCo in the AVLN.
@@ -304,7 +356,7 @@ cp_net_sta_add (cp_net_t *ctx, u8 tei, mac_t mac_address,
* Remove the station from the AVLN.
*/
void
-cp_net_sta_remove (cp_net_t *ctx, u8 tei)
+cp_net_sta_remove_assoc (cp_net_t *ctx, u8 tei)
{
cp_sta_private_t *sta;
@@ -335,9 +387,115 @@ cp_net_sta_remove (cp_net_t *ctx, u8 tei)
//release the station.
blk_release (sta);
}
+
+ // TODO : If the net is empty post an event to the FSM.
+ // Check the associated list.
+ if (set_empty (&ctx->unassociated_stas)
+ && set_empty (&ctx->associated_stas))
+ {
+ ctx->present = false;
+ }
}
/**
+ * Remove an unassociated station from the list.
+ * \param ctx the module context.
+ * \param mac_addr The station's mac address.
+ *
+ */
+void
+cp_net_sta_remove_unassc (cp_net_t *ctx, mac_t mac_addr)
+{
+ cp_sta_private_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (mac_addr);
+
+ sta = (cp_sta_private_t *) cp_net_get_sta_unassoc (ctx, mac_addr);
+
+ // Verify the node and delete the node from the set.
+ if (sta)
+ {
+ // The get STA returns another reference on the station which we
+ // want to release this reference is not useful, this release
+ // allows to remove the reference just added by the get STA.
+ blk_release (sta);
+
+ set_remove (&ctx->unassociated_stas, &sta->node);
+
+ //release the station.
+ blk_release (sta);
+ }
+
+ // TODO : If the net is empty post an event to the FSM.
+ // Check the associated list.
+ if (set_empty (&ctx->unassociated_stas)
+ && set_empty (&ctx->associated_stas))
+ {
+ ctx->present = false;
+ }
+
+}
+
+/**
+ * Remove the station from the net.
+ * \param ctx the module context.
+ * \param sta The station to remove.
+ *
+ * The user shall release the reference
+ */
+void
+cp_net_sta_remove (cp_net_t *ctx, cp_sta_t * sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (sta);
+
+ if(sta->station_state != CP_STA_STATE_EXISTS)
+ cp_net_sta_remove_assoc (ctx, ((cp_sta_private_t *)sta)->tei);
+ else
+ cp_net_sta_remove_unassc (ctx, ((cp_sta_private_t
+ *)sta)->mac_address);
+}
+
+/**
+ * Get the unassociated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_unassoc (cp_net_t *ctx, mac_t mac_addr)
+{
+ cp_sta_private_t *sta;
+ cp_sta_private_t sta_to_find;
+ set_node_t *sta_node;
+
+ dbg_assert (ctx);
+ dbg_assert (mac_addr);
+
+ // if list is empty do nothing.
+ if (set_empty (&ctx->unassociated_stas))
+ return NULL;
+
+ sta_to_find.mac_address = mac_addr;
+ set_node_init (&sta_to_find.node);
+
+ sta_node = set_find (&ctx->unassociated_stas, &sta_to_find.node);
+
+ if (!sta_node)
+ return NULL;
+
+ sta = PARENT_OF (cp_sta_private_t, node, sta_node);
+ blk_addref (sta);
+ return (cp_sta_t *) sta;
+}
+
+
+/**
* Get the station identified by its TEI.
* \param ctx the module context.
* \param tei The station's tei.
@@ -432,7 +590,7 @@ cp_net_commit_to_dataplane (cp_net_t *ctx, cp_t *cp)
/**
* Returns the first station of an AVLN.
* \param ctx the module context.
- * \param assoc to search in the associated stations or unassociated STAs.
+ * \param status to search in the associated stations or unassociated STAs.
* \return the Station with the minimal TEI for the associated stations, the
* one with the minimal mac address for the unassociated.
*
@@ -440,17 +598,17 @@ cp_net_commit_to_dataplane (cp_net_t *ctx, cp_t *cp)
* The user has the responsibility to release the reference.
*/
cp_sta_t *
-cp_net_get_first (cp_net_t *ctx, bool assoc)
+cp_net_get_first (cp_net_t *ctx, enum cp_sta_state_t status)
{
set_t *set;
cp_sta_t *sta;
dbg_assert (ctx);
- if (assoc)
- set = &ctx->associated_stas;
- else
+ if (status == CP_STA_STATE_EXISTS)
set = &ctx->unassociated_stas;
+ else
+ set = &ctx->associated_stas;
// Verify if the set contains a sta.
if (set_empty (set))
diff --git a/cesar/cp2/sta/mgr/src/net_list.c b/cesar/cp2/sta/mgr/src/net_list.c
index dd8adcebac..e4871c25cd 100644
--- a/cesar/cp2/sta/mgr/src/net_list.c
+++ b/cesar/cp2/sta/mgr/src/net_list.c
@@ -56,7 +56,16 @@ cp_net_list_uninit (cp_net_list_t *ctx)
*
*/
void
-cp_net_list_garbage_net (cp_net_list_t *ctx);
+cp_net_list_garbage_net (cp_net_list_t *ctx)
+{
+ uint i;
+ dbg_assert (ctx);
+
+ for (i = 1; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ cp_net_garbage_stations (&ctx->networks[i]);
+ }
+}
/**
* Add an AVLN to the list.
diff --git a/cesar/cp2/sta/mgr/src/sta_mgr.c b/cesar/cp2/sta/mgr/src/sta_mgr.c
index 9a86bb4dac..077ba85cd9 100644
--- a/cesar/cp2/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp2/sta/mgr/src/sta_mgr.c
@@ -153,10 +153,13 @@ cp_sta_mgr_get_present_snids (cp_sta_mgr_t *ctx)
/**
* Call all the sub garbage functions.
* \param ctx the module context.
- *
*/
void
-cp_sta_mgr_garbage (cp_sta_mgr_t *ctx);
+cp_sta_mgr_garbage (cp_sta_mgr_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_net_list_garbage_net (&ctx->network_list);
+}
/**
* Update the our avln's snid.
diff --git a/cesar/cp2/sta/mgr/sta.h b/cesar/cp2/sta/mgr/sta.h
index cce3d42ae4..a988ef2526 100644
--- a/cesar/cp2/sta/mgr/sta.h
+++ b/cesar/cp2/sta/mgr/sta.h
@@ -19,7 +19,8 @@ enum cp_sta_state_t
{
CP_STA_STATE_EXISTS,
CP_STA_STATE_ASSOCIATED,
- CP_STA_STATE_AUTHENTICATED
+ CP_STA_STATE_AUTHENTICATED,
+ CP_STA_STATE_MAX
};
typedef enum cp_sta_state_t cp_sta_state_t;
diff --git a/cesar/cp2/sta/mgr/test/Makefile b/cesar/cp2/sta/mgr/test/Makefile
index aa262bc073..3f62ca937c 100644
--- a/cesar/cp2/sta/mgr/test/Makefile
+++ b/cesar/cp2/sta/mgr/test/Makefile
@@ -8,12 +8,12 @@ station_test_SOURCES = station_test.c
station_test_MODULES = lib cp2/sta/mgr
net_test_SOURCES = net_test.c cl_stub.c
-net_test_MODULES = lib cp2/sta/mgr
+net_test_MODULES = lib cp2/sta/mgr mac/common
net_list_test_SOURCES= net_list_test.c cl_stub.c
-net_list_test_MODULES= lib cp2/sta/mgr
+net_list_test_MODULES= lib cp2/sta/mgr mac/common
sta_mgr_test_SOURCES= sta_mgr_test.c cl_stub.c
-sta_mgr_test_MODULES= lib cp2/sta/mgr cp2/sta/data
+sta_mgr_test_MODULES= lib cp2/sta/mgr cp2/sta/data mac/common
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp2/sta/mgr/test/doc/net.txt b/cesar/cp2/sta/mgr/test/doc/net.txt
index 777b73274e..d4ae96f661 100644
--- a/cesar/cp2/sta/mgr/test/doc/net.txt
+++ b/cesar/cp2/sta/mgr/test/doc/net.txt
@@ -106,4 +106,36 @@ list will be present in it.
Garbage
-------
-Not tested yet.
+Verify the expiration date of all the station in the network. It the network
+is empty it shall post an event in the FSM.
+
+Environment
+~~~~~~~~~~~
+
+Add an AVLN and some station with different status.
+
+Three associated and three not associated stations.
+
++-----+-------+-----+-------+-----------+
+| sta | assoc | tei | mac @ | last seen |
++-----+-------+-----+-------+-----------+
+| 1 | false | 0 | 1 | 5 |
++-----+-------+-----+-------+-----------+
+| 2 | false | 0 | 2 | 7 |
++-----+-------+-----+-------+-----------+
+| 3 | false | 0 | 3 | 9 |
++-----+-------+-----+-------+-----------+
+| 4 | true | 1 | 1 | 6 |
++-----+-------+-----+-------+-----------+
+| 5 | true | 2 | 5 | 8 |
++-----+-------+-----+-------+-----------+
+| 6 | true | 3 | 9 | 10 |
++-----+-------+-----+-------+-----------+
+
+Result
+~~~~~~
+
+The station 1 and the station 4 shall be expired and shall not appear in the
+list after the garbage.
+
+The others shall be still present.
diff --git a/cesar/cp2/sta/mgr/test/src/net_test.c b/cesar/cp2/sta/mgr/test/src/net_test.c
index 7a09da11e4..a52a1c41d8 100644
--- a/cesar/cp2/sta/mgr/test/src/net_test.c
+++ b/cesar/cp2/sta/mgr/test/src/net_test.c
@@ -18,6 +18,8 @@
#include "lib/blk.h"
#include "lib/bitstream.h"
+#include "mac/common/ntb.h"
+
#include "cp2/sta/mgr/net.h"
#include "cp2/sta/mgr/inc/net.h"
@@ -129,7 +131,7 @@ test_case_network_add_assoc_stations (test_t test)
"Wrong station state");
blk_release (sta[i]);
- cp_net_sta_remove (&net, i + 1);
+ cp_net_sta_remove_assoc (&net, i + 1);
}
test_fail_if (set_empty (&net.associated_stas) != true,
@@ -190,7 +192,7 @@ test_case_network_add_auth_stations (test_t test)
"Wrong station state");
blk_release (sta[i]);
- cp_net_sta_remove (&net, i + 1);
+ cp_net_sta_remove_assoc (&net, i + 1);
}
test_fail_if (set_empty (&net.associated_stas) != true,
@@ -255,7 +257,7 @@ test_case_network_add_auth_stations_last_is_cco (test_t test)
"wrong CCo status sta[%d]", i);
blk_release (sta[i]);
- cp_net_sta_remove (&net, i + 1);
+ cp_net_sta_remove_assoc (&net, i + 1);
}
test_fail_if (set_empty (&net.associated_stas) != true,
@@ -320,7 +322,7 @@ test_case_network_add_auth_stations_last_is_pco (test_t test)
"wrong PCo status sta[%d]", i);
blk_release (sta[i]);
- cp_net_sta_remove (&net, i + 1);
+ cp_net_sta_remove_assoc (&net, i + 1);
}
test_fail_if (set_empty (&net.associated_stas) != true,
@@ -361,7 +363,7 @@ test_case_remove_stations (test_t test)
for (i = 0; i < 10; i++)
{
- cp_net_sta_remove (&net, i + 1);
+ cp_net_sta_remove_assoc (&net, i + 1);
}
test_begin (test, "Verify if list is empty")
@@ -423,9 +425,9 @@ test_case_remove_sta_cco_station (test_t test)
// remove the CCo.
- cp_net_sta_remove (&net, 3);
+ cp_net_sta_remove_assoc (&net, 3);
- sta[0] = cp_net_get_first (&net, true);
+ sta[0] = cp_net_get_first (&net, CP_STA_STATE_ASSOCIATED);
for (i = 1; (sta[i] = cp_net_get_next_sta (&net, sta[i-1])); i++);
test_begin (test, "Verifying the absence of CCo in the AVLN")
@@ -492,9 +494,9 @@ test_case_remove_sta_pco_station (test_t test)
// remove the PCo.
- cp_net_sta_remove (&net, 3);
+ cp_net_sta_remove_assoc (&net, 3);
- sta[0] = cp_net_get_first (&net, true);
+ sta[0] = cp_net_get_first (&net, CP_STA_STATE_ASSOCIATED);
for (i = 1; (sta[i] = cp_net_get_next_sta (&net, sta[i-1])); i++);
test_begin (test, "Verifying the absence of PCo in the AVLN")
@@ -544,7 +546,7 @@ test_case_cco (test_t test)
blk_release (cco);
// remove the cco.
- cp_net_sta_remove (&net, 1);
+ cp_net_sta_remove_assoc (&net, 1);
test_begin (test, "get cco, cco doesn't exists anymore")
{
@@ -601,7 +603,7 @@ test_case_pco (test_t test)
blk_release (pco);
// remove the pco.
- cp_net_sta_remove (&net, 1);
+ cp_net_sta_remove_assoc (&net, 1);
test_begin (test, "get pco, pco doesn't exists anymore")
{
@@ -731,17 +733,69 @@ test_case_commit (test_t test)
* the garbage collector of the net.
*/
void
-test_case_garbage (test_t test)
+test_case_garbage (test_t test, phy_t *phy)
{
+ cp_sta_t *sta;
+ cp_net_t net;
+ uint i;
+
test_case_begin (test, "Garbage");
+
+ cp_net_init (&net, false);
+
+ //cp_net_sta_add (cp_net_t *ctx, u8 tei, mac_t mac_address,
+ // bool authenticated, bool cco, bool pco, bool backup_cco)
+
+ for (i = 0; i < 3; i++)
+ {
+ // unassoc sta.
+ sta = cp_net_sta_add (&net, 0, i + 1,
+ false, false, false, false);
+ sta->last_seen_ntb = 2 * i + 5;
+ blk_release (sta);
+
+ // assoc sta.
+ sta = cp_net_sta_add (&net, i + 1, 4*i + 1,
+ false, false, false, false);
+ sta->last_seen_ntb = 2 * i + 6;
+ blk_release (sta);
+ }
+
+ *((uint*)phy) = CP_STA_EXPIRATION_DELAY + 8;
+ cp_net_garbage_stations (&net);
+
+ test_begin (test, "Expiration of 2 stations")
+ {
+ sta = cp_net_get_first(&net, CP_STA_STATE_ASSOCIATED);
+
+ test_fail_if (sta == NULL,
+ "list shall not be empty");
+
+ test_fail_if (cp_sta_get_tei (sta) != 2,
+ "Station 1 has not been expired");
+ blk_release (sta);
+
+ sta = cp_net_get_first(&net, CP_STA_STATE_EXISTS);
+
+ test_fail_if (cp_sta_get_mac_address (sta) == 1,
+ "Station with Mac@ 1 has not been expired");
+ blk_release (sta);
+
+ }
+ test_end;
+
+ cp_net_uninit (&net);
}
int
main (void)
{
test_t test;
+ uint phy = 0;
+ mac_config_t mac_config;
test_init (test, 0, NULL);
+ mac_ntb_init ((phy_t*) &phy, &mac_config);
test_case_network_add_unassoc_stations (test);
test_case_network_add_assoc_stations (test);
@@ -755,6 +809,7 @@ main (void)
test_case_pco (test);
test_case_commit (test);
test_case_add_twice_same_sta (test);
+ test_case_garbage (test, (phy_t *) &phy);
test_case_begin (test, "Memory allocation");
@@ -768,3 +823,19 @@ main (void)
HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
return test_nb_failed (test) == 0 ? 0 : 1;
}
+
+/**
+ * Create a phy_date weak function to do not have to include the phy on test
+ * when it is not necessary.
+ *
+ * \param phy the phy context.
+ * \return the phy date.
+ */
+u32
+phy_date (phy_t *phy)
+{
+ dbg_assert (phy);
+
+ return *((uint*) phy);
+}
+
diff --git a/cesar/cp2/sta/mgr/test/src/station_test.c b/cesar/cp2/sta/mgr/test/src/station_test.c
index 5b0718f4a0..3b21f05233 100644
--- a/cesar/cp2/sta/mgr/test/src/station_test.c
+++ b/cesar/cp2/sta/mgr/test/src/station_test.c
@@ -11,6 +11,9 @@
* \ingroup cp2_sta_mgr
*
*/
+#include <cyg/hal/hal_arch.h>
+#include <cyg/kernel/kapi.h>
+
#include "common/std.h"
#include "string.h"
@@ -173,5 +176,6 @@ main (void)
test_case_get_pco_status (test);
test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
return test_nb_failed (test) == 0 ? 0 : 1;
}