This commit is contained in:
2025-09-15 17:41:36 +02:00
parent f09be2ba12
commit 0a8f7e1707
4 changed files with 565 additions and 58 deletions
+40
View File
@@ -0,0 +1,40 @@
## daemon.c:
create_daemon = 6
ping_request = 2
send_check = 4
check_keep_working = 5
daemon_work = 4
## db-sqlite.c:
db_connect = 1
db_disconnect = 1
insert_hourly_report = 1
## ping-report.c:
main = 4
## stats.c :
ce fus un plasir immence de réaliser les graphs et de comté la complexité des fonctions j'ai retenue la lesson je fera au minimum des fonction avec une complexite trop grande
get_ping_from_temp_log = 14
write_ping_log = 2
void set_stats_ping = 12
## utils.c:
write_pid_file = 2
remove_file = 1
On a créer la fonction " remplacement "on a factoriser un bout de la methode por avoir une complexité plus fable
Maxime Lebreton
Maxime Aubert
+273
View File
@@ -0,0 +1,273 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0" version="28.2.1">
<diagram name="Page-1" id="jYP7Spb8xoJFoSsjHxG4">
<mxGraphModel dx="1483" dy="963" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="P1gOgU71GawhJi7SdRQG-164" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-1" target="P1gOgU71GawhJi7SdRQG-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-1" value="&lt;div style=&quot;color: #cccccc;background-color: #1f1f1f;font-family: &#39;Droid Sans Mono&#39;, &#39;monospace&#39;, monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;get_ping_from_temp_log&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" parent="1" vertex="1">
<mxGeometry x="250.5" y="40" width="250" height="60" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=10;" parent="1" target="P1gOgU71GawhJi7SdRQG-67" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="517" y="290" as="targetPoint" />
<mxPoint x="422.49" y="210" as="sourcePoint" />
<Array as="points">
<mxPoint x="518" y="210" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-3" target="P1gOgU71GawhJi7SdRQG-76" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="376" y="320" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-3" value="&lt;font style=&quot;font-size: 9px;&quot;&gt;if(p_reg == NULL)&lt;/font&gt;" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="328" y="170" width="95" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-7" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="440" y="170" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-8" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="292.5" y="270" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-67" value="RETURN" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="475" y="300" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-74" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=10;" parent="1" target="P1gOgU71GawhJi7SdRQG-79" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="517" y="450" as="targetPoint" />
<mxPoint x="422.49" y="370" as="sourcePoint" />
<Array as="points">
<mxPoint x="518" y="370" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-75" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-76" target="P1gOgU71GawhJi7SdRQG-89" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="375.5" y="489.9999999999999" as="targetPoint" />
<Array as="points">
<mxPoint x="376" y="460" />
<mxPoint x="383" y="460" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-76" value="if(fd == NULL)" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="328" y="330" width="95" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-77" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="430" y="340" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-78" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="305" y="430" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-79" value="RETURN" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="475" y="460" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-82" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="650" y="450" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-83" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="517.5" y="730" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-84" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="732.01" y="760" as="targetPoint" />
<mxPoint x="637.5" y="680" as="sourcePoint" />
<Array as="points">
<mxPoint x="732.01" y="680" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-97" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-86" target="P1gOgU71GawhJi7SdRQG-90" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-86" value="if(p_reg != NULL)" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="510" y="640" width="125" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-87" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="670" y="650" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-88" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="312.5" y="840" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-99" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-89" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="573" y="640" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-102" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-89" target="P1gOgU71GawhJi7SdRQG-93" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="382" y="780" />
<mxPoint x="380" y="780" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-89" value="if(regcomp..." style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="320" y="490" width="125" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-90" value="RETURN" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="690" y="780" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-91" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=10;" parent="1" target="P1gOgU71GawhJi7SdRQG-96" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="522" y="1110" as="targetPoint" />
<mxPoint x="427.49" y="1030" as="sourcePoint" />
<Array as="points">
<mxPoint x="523" y="1030" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-92" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-93" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="381" y="1150" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-93" value="&lt;font style=&quot;font-size: 9px;&quot;&gt;if(p_reg == NULL)&lt;/font&gt;" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="333" y="990" width="95" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-94" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="445" y="990" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-95" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="297.5" y="1090" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-96" value="RETURN" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="480" y="1120" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-103" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=10;" parent="1" target="P1gOgU71GawhJi7SdRQG-108" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="522" y="1270" as="targetPoint" />
<mxPoint x="427.49" y="1190" as="sourcePoint" />
<Array as="points">
<mxPoint x="523" y="1190" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-104" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-105" target="P1gOgU71GawhJi7SdRQG-128" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="381" y="1310" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-105" value="if(pmatch == NULL" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="333" y="1150" width="95" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-106" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="430" y="1160" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-107" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="297.5" y="1250" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-108" value="RETURN" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="480" y="1280" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-137" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-128" target="P1gOgU71GawhJi7SdRQG-132" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-128" value="WHILE" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="333" y="1330" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-153" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="P1gOgU71GawhJi7SdRQG-132" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="970" y="2090" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-132" value="if(read_line" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="577.5" y="1400" width="95" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-139" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="625" y="1560" as="targetPoint" />
<mxPoint x="625" y="1480" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-140" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="565" y="1500" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-142" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="690" y="1400" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-144" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="517.5" y="1340" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-146" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="969.51" y="1830" as="targetPoint" />
<mxPoint x="875" y="1750" as="sourcePoint" />
<Array as="points">
<mxPoint x="969.51" y="1750" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-147" value="&lt;div&gt;if(ping == NULL)&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="747.5" y="1710" width="125" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-148" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="890" y="1700" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-149" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="430" y="1650" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-150" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="P1gOgU71GawhJi7SdRQG-151" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="970" y="1680" as="targetPoint" />
<Array as="points">
<mxPoint x="810" y="1600" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-151" value="if(regexec..." style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="557.5" y="1560" width="125" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-154" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;endArrow=none;endFill=0;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="809.93" y="1790" as="sourcePoint" />
<mxPoint x="960" y="2090" as="targetPoint" />
<Array as="points">
<mxPoint x="700" y="1790" />
<mxPoint x="700" y="2060" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-155" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;endArrow=classic;endFill=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="619.93" y="1640" as="sourcePoint" />
<mxPoint x="330" y="1370" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-156" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="630" y="1890" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-157" value="THE ENDDDDDD" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="920" y="2270" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-158" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="P1gOgU71GawhJi7SdRQG-160" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="970" y="2260" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-159" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="985" y="2260" as="targetPoint" />
<mxPoint x="1009.49" y="2140" as="sourcePoint" />
<Array as="points">
<mxPoint x="1104" y="2140" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-160" value="if(read_line" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="930" y="2100" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-161" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="910" y="2180" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-162" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1105" y="2170" width="60" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
+79 -57
View File
@@ -11,6 +11,59 @@
#include "../include/stats.h"
#include "../include/db-sqlite.h"
void factorisation(){
/* Read file */
while(getline(&read_line,&n,fd) != -1){
if(read_line == NULL){
break;
}
/* Exec regex to find ping */
if(regexec(p_reg,read_line,nmatch,pmatch,0) == 0){
/* Extract ping position from read line */
start = (int) pmatch[1].rm_so;
end = (int) pmatch[1].rm_eo;
size_ping = (size_t) (end - start);
/* ping string memory allocation */
ping = malloc(sizeof(char) * (size_ping+2));
if(ping == NULL){
free(read_line);
read_line = NULL;
n = 0;
break;
}
/* Create ping string */
(void) strncpy(ping, &read_line[start], size_ping);
ping[size_ping]='\n';
ping[size_ping+1]='\0';
/* Free memory */
free(read_line);
read_line = NULL;
n = 0;
break;
}
free(read_line);
read_line = NULL;
n = 0;
}
}
/*
-- get_ping_from_temp_log --
Desc :
@@ -67,47 +120,7 @@
return ping; /* NULL */
}
/* Read file */
while(getline(&read_line,&n,fd) != -1){
if(read_line == NULL){
break;
}
/* Exec regex to find ping */
if(regexec(p_reg,read_line,nmatch,pmatch,0) == 0){
/* Extract ping position from read line */
start = (int) pmatch[1].rm_so;
end = (int) pmatch[1].rm_eo;
size_ping = (size_t) (end - start);
/* ping string memory allocation */
ping = malloc(sizeof(char) * (size_ping+2));
if(ping == NULL){
free(read_line);
read_line = NULL;
n = 0;
break;
}
/* Create ping string */
(void) strncpy(ping, &read_line[start], size_ping);
ping[size_ping]='\n';
ping[size_ping+1]='\0';
/* Free memory */
free(read_line);
read_line = NULL;
n = 0;
break;
}
free(read_line);
read_line = NULL;
n = 0;
}
factorisation();
/* free allocated memory */
regfree(p_reg);
@@ -171,6 +184,30 @@ void write_ping_log(char* new_ping){
Return value :
None
*/
void remplacement(){
/* Number of ping readed (for mean calculation) */
nb_ping++;
/* Max ping */
if(ping > max){
max = ping;
}
/* Min ping */
if(ping < min){
min = ping;
}
/* Number of ping above 100 ms */
if(ping > 100.0){
nb_high++;
}
/* Sum (for mean calculation) */
sum += ping;
}
void set_stats_ping(){
/* Variables */
@@ -209,22 +246,7 @@ void set_stats_ping(){
if(ping < 0.1){
/* Ignore null ping */
}else{
/* Number of ping readed (for mean calculation) */
nb_ping++;
/* Max ping */
if(ping > max){
max = ping;
}
/* Min ping */
if(ping < min){
min = ping;
}
/* Number of ping above 100 ms */
if(ping > 100.0){
nb_high++;
}
/* Sum (for mean calculation) */
sum += ping;
remplacement();
}
}
free(read_line);
+172
View File
@@ -0,0 +1,172 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0" version="28.2.1">
<diagram name="Page-1" id="jYP7Spb8xoJFoSsjHxG4">
<mxGraphModel dx="1825" dy="1185" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="P1gOgU71GawhJi7SdRQG-170" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-165" target="P1gOgU71GawhJi7SdRQG-166">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-165" value="&lt;div style=&quot;color: #cccccc;background-color: #1f1f1f;font-family: &#39;Droid Sans Mono&#39;, &#39;monospace&#39;, monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;set_stats_ping&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;" vertex="1" parent="1">
<mxGeometry x="200" y="30" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-169" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-166" target="P1gOgU71GawhJi7SdRQG-168">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-189" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-166" target="P1gOgU71GawhJi7SdRQG-188">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-166" value="if(fd != NULL)" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="220" y="140" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-167" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="170" y="250" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-168" value="&lt;div&gt;perror&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="235" y="310" width="50" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-192" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-188" target="P1gOgU71GawhJi7SdRQG-190">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-188" value="While" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="400" y="260" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-194" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-190" target="P1gOgU71GawhJi7SdRQG-193">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-217" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=none;endFill=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-190" target="P1gOgU71GawhJi7SdRQG-214">
<mxGeometry relative="1" as="geometry">
<mxPoint x="760" y="1270" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-190" value="if read_line" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="410" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-191" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="350" y="140" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-197" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-193" target="P1gOgU71GawhJi7SdRQG-196">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-219" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-193" target="P1gOgU71GawhJi7SdRQG-188">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-193" value="if(strcmp(..." style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="570" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-195" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="520" y="500" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-196" value="&lt;div&gt;else&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="710" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-198" value="non" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="520" y="660" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-199" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" target="P1gOgU71GawhJi7SdRQG-200">
<mxGeometry relative="1" as="geometry">
<mxPoint x="600" y="790" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-224" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-200" target="P1gOgU71GawhJi7SdRQG-206">
<mxGeometry relative="1" as="geometry">
<mxPoint x="680" y="1000" as="targetPoint" />
<Array as="points">
<mxPoint x="660" y="890" />
<mxPoint x="660" y="960" />
<mxPoint x="620" y="960" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-200" value="&lt;div&gt;ping&amp;gt;max&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="850" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-204" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" target="P1gOgU71GawhJi7SdRQG-206">
<mxGeometry relative="1" as="geometry">
<mxPoint x="600" y="930" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-206" value="&lt;div&gt;ping&amp;gt;min&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="990" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-207" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;endArrow=none;endFill=0;" edge="1" parent="1" target="P1gOgU71GawhJi7SdRQG-209">
<mxGeometry relative="1" as="geometry">
<mxPoint x="600" y="1070" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-221" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-209" target="P1gOgU71GawhJi7SdRQG-188">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-222" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-209">
<mxGeometry relative="1" as="geometry">
<mxPoint x="440" y="1250" as="targetPoint" />
<Array as="points">
<mxPoint x="710" y="1170" />
<mxPoint x="710" y="1230" />
<mxPoint x="441" y="1230" />
<mxPoint x="441" y="1250" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-209" value="&lt;div&gt;ping&amp;gt;100.0&lt;/div&gt;" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="1130" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-211" value="FIN" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="700" y="1440" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-212" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="P1gOgU71GawhJi7SdRQG-214">
<mxGeometry relative="1" as="geometry">
<mxPoint x="760" y="1440" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-213" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" target="P1gOgU71GawhJi7SdRQG-211">
<mxGeometry relative="1" as="geometry">
<mxPoint x="775" y="1440" as="targetPoint" />
<mxPoint x="799.49" y="1320" as="sourcePoint" />
<Array as="points">
<mxPoint x="894" y="1320" />
<mxPoint x="894" y="1480" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-214" value="if(read_line" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="720" y="1280" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-215" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="700" y="1360" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-216" value="&lt;div&gt;non&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="895" y="1350" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-218" value="oui" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="670" y="428" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-220" value="&lt;div&gt;oui&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="480" y="578" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-227" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="620" y="1150" as="targetPoint" />
<mxPoint x="640" y="1030" as="sourcePoint" />
<Array as="points">
<mxPoint x="660" y="1030" />
<mxPoint x="660" y="1100" />
<mxPoint x="620" y="1100" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="P1gOgU71GawhJi7SdRQG-228" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="620" y="870" as="targetPoint" />
<mxPoint x="640" y="750" as="sourcePoint" />
<Array as="points">
<mxPoint x="660" y="750" />
<mxPoint x="660" y="820" />
<mxPoint x="620" y="820" />
</Array>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>