\hypertarget{ecore_con_server_example_8c-example}{}\doxysection{ecore\+\_\+con\+\_\+server\+\_\+example.\+c}
Shows how to write a simple server using the Ecore\+\_\+\+Con library using \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga8993f75b5a4948b6b3975575d807fb21}{ecore\+\_\+con\+\_\+server\+\_\+add()}}

Shows how to write a simple server using the Ecore\+\_\+\+Con library using \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga8993f75b5a4948b6b3975575d807fb21}{ecore\+\_\+con\+\_\+server\+\_\+add()}}


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//\ gcc\ -\/o\ ecore\_con\_server\_example\ ecore\_con\_server\_example.c\ `pkg-\/config\ -\/-\/libs\ -\/-\/cflags\ ecore\ ecore-\/con\ eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifdef\ HAVE\_CONFIG\_H}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ "{}config.h"{}}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore\_Con.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Ecore\_Getopt.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ Ecore\_Con\ server\ example}}
\DoxyCodeLine{\textcolor{comment}{\ *\ 2010\ Mike\ Blumenkrantz}}
\DoxyCodeLine{\textcolor{comment}{\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ retval\ =\ EXIT\_SUCCESS;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ echo\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ do\_flush\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ single\_message\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ do\_ssl\_upgrade\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_add(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add}{Ecore\_Con\_Event\_Client\_Add}}\ *ev\ =\ event;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ client\ added\ \%p:\ \%s\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}}));}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!echo)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga89f79f973aeea2505078d87cb7b045b3}{ecore\_con\_client\_send}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}},\ \textcolor{stringliteral}{"{}Hello\ World!"{}},\ strlen(\textcolor{stringliteral}{"{}Hello\ World!"{}}));}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (do\_flush)\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga8eeeb449d9af80885a26309471330de9}{ecore\_con\_client\_flush}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (single\_message)\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab961e9decd8dc44e4c04f2ceb0ce2e68}{ecore\_con\_client\_del}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (do\_ssl\_upgrade)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ upgrade\_msg[]\ =\ \textcolor{stringliteral}{"{}\(\backslash\)nSend\ \(\backslash\)"{}Upgrade:\ SSL\(\backslash\)"{}\ followed\ by\ newline\ (\(\backslash\)\(\backslash\)n)\ to\ do\ it.\(\backslash\)n"{}};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga89f79f973aeea2505078d87cb7b045b3}{ecore\_con\_client\_send}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}},\ upgrade\_msg,\ strlen(upgrade\_msg));}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (do\_flush)\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga8eeeb449d9af80885a26309471330de9}{ecore\_con\_client\_flush}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Add_a9877727e79213077e8592dfca5895cbe}{client}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_del(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Del}{Ecore\_Con\_Event\_Client\_Del}}\ *ev\ =\ event;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ client\ deleted\ \%p:\ \%s!\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Del_a47278613bc4acaf1d9f3e8c217fd2035}{client}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Del_a47278613bc4acaf1d9f3e8c217fd2035}{client}}));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab961e9decd8dc44e4c04f2ceb0ce2e68}{ecore\_con\_client\_del}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Del_a47278613bc4acaf1d9f3e8c217fd2035}{client}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_data(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data}{Ecore\_Con\_Event\_Client\_Data}}\ *ev\ =\ event;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ upgrade\_ssl[]\ =\ \textcolor{stringliteral}{"{}Upgrade:\ SSL\(\backslash\)n"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ client\ data\ \%p:\ \%s\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}INFO:\ \ -\/\ size:\ \%d\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}-\/-\/\ BEGIN\ DATA\ -\/-\/\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}}),}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a6e87f88d094ec774fb22133a0632d8b3}{size}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ fwrite(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a1e2cdb017a18b0515d2102edc016b4c5}{data}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a6e87f88d094ec774fb22133a0632d8b3}{size}},\ 1,\ stdout);}
\DoxyCodeLine{\ \ \ puts(\textcolor{stringliteral}{"{}-\/-\/\ END\ DATA\ -\/-\/"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (do\_ssl\_upgrade\ \&\&\ ((\textcolor{keywordtype}{size\_t})ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a6e87f88d094ec774fb22133a0632d8b3}{size}}\ ==\ strlen(upgrade\_ssl))\ \&\&}
\DoxyCodeLine{\ \ \ \ \ \ \ (memcmp(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a1e2cdb017a18b0515d2102edc016b4c5}{data}},\ upgrade\_ssl,\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a6e87f88d094ec774fb22133a0632d8b3}{size}})\ ==\ 0))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Ecore__Con__SSL__Group_ga91cb5d6868be1c3578ce21c7f786de3a}{ecore\_con\_ssl\_client\_upgrade}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}},\ ECORE\_CON\_USE\_MIXED\ |\ ECORE\_CON\_LOAD\_CERT))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}ERROR:\ Failed\ to\ upgrade\ client=\%p\ \%s\ to\ SSL!\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}}));}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab961e9decd8dc44e4c04f2ceb0ce2e68}{ecore\_con\_client\_del}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ upgrading\ client=\%p\ \%s\ to\ SSL!\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}}));}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (echo)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga89f79f973aeea2505078d87cb7b045b3}{ecore\_con\_client\_send}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a1e2cdb017a18b0515d2102edc016b4c5}{data}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a6e87f88d094ec774fb22133a0632d8b3}{size}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (do\_flush)\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_ga8eeeb449d9af80885a26309471330de9}{ecore\_con\_client\_flush}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (single\_message)\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab961e9decd8dc44e4c04f2ceb0ce2e68}{ecore\_con\_client\_del}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Data_a2c3e5b340b67fde235d2da9814f3d413}{client}});}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_write\_(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Write}{Ecore\_Con\_Event\_Client\_Write}}\ *ev\ =\ event;}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Sent\ \%d\ bytes\ to\ client\ \%s\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Write_aa2c55cb5cd05d6a8bfd4d4d136c7ec67}{size}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Write_a9809cc4ba33aeb1140d0f6580c5a9c87}{client}}));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_error(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Error}{Ecore\_Con\_Event\_Client\_Error}}\ *ev\ =\ event;}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Client\ \%s\ Error:\ \%s\(\backslash\)n"{}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Error_a6463c806c1a005beba350fdfaba2f66c}{client}}),\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Error_a172b336eea14a83c74bffc9efdf76fe1}{error}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_upgrade(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{int}\ type\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Ecore__Con__Event__Client__Upgrade}{Ecore\_Con\_Event\_Client\_Upgrade}}\ *ev\ =\ event;}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Client\ \%s\ Upgraded\ to\ SSL.\(\backslash\)n"{}},\ \mbox{\hyperlink{group__Ecore__Con__Client__Group_gab02f9ae8613aca1de53996239dd5f7ea}{ecore\_con\_client\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Client__Upgrade_af34b2ec2f75af3055624922135985675}{client}}));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *types\_strs[]\ =\ \{}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}tcp"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}udp"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}ssl"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}tcp+ssl"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}mcast"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}local-\/user"{}},}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}local-\/system"{}},}
\DoxyCodeLine{\ \ NULL}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct__Ecore__Getopt}{Ecore\_Getopt}}\ options\ =\ \{}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}ecore\_con\_server\_example"{}},\ \textcolor{comment}{/*\ program\ name\ */}}
\DoxyCodeLine{\ \ NULL,\ \textcolor{comment}{/*\ usage\ line\ */}}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}1"{}},\ \textcolor{comment}{/*\ version\ */}}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}(C)\ 2016\ Enlightenment\ Project;\ 2010\ Mike\ Blumenkrantz"{}},\ \textcolor{comment}{/*\ copyright\ */}}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}BSD\ 2-\/Clause"{}},\ \textcolor{comment}{/*\ license\ */}}
\DoxyCodeLine{\ \ \textcolor{comment}{/*\ long\ description,\ may\ be\ multiline\ and\ contain\ \(\backslash\)n\ */}}
\DoxyCodeLine{\ \ \textcolor{stringliteral}{"{}Example\ of\ ecore\_con\_server\_add()\ usage.\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}},}
\DoxyCodeLine{\ \ \{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga0bceaa55f928e281a24be27089d4b8d6}{ECORE\_GETOPT\_CHOICE}}(\textcolor{charliteral}{'t'},\ \textcolor{stringliteral}{"{}type"{}},\ \textcolor{stringliteral}{"{}Server\ type\ to\ use,\ defaults\ to\ 'tcp'"{}},\ types\_strs),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad2ae11581fad6e818ed8bfe1a31d5635}{ECORE\_GETOPT\_STORE\_TRUE}}(0,\ \textcolor{stringliteral}{"{}socket-\/activated"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Try\ to\ use\ \$LISTEN\_FDS\ from\ systemd,\ if\ not\ do\ a\ regular\ serve"{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gae2ee4724bff2a0cf9acdbdbb74351745}{ECORE\_GETOPT\_STORE\_INT}}(\textcolor{charliteral}{'l'},\ \textcolor{stringliteral}{"{}clients-\/limit"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}If\ set\ will\ limit\ number\ of\ clients\ to\ accept"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad2ae11581fad6e818ed8bfe1a31d5635}{ECORE\_GETOPT\_STORE\_TRUE}}(\textcolor{charliteral}{'r'},\ \textcolor{stringliteral}{"{}clients-\/reject-\/excess"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Immediately\ reject\ excess\ clients\ (over\ limit)"{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad2ae11581fad6e818ed8bfe1a31d5635}{ECORE\_GETOPT\_STORE\_TRUE}}(\textcolor{charliteral}{'e'},\ \textcolor{stringliteral}{"{}echo"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Behave\ as\ 'echo'\ server,\ send\ back\ to\ client\ all\ the\ data\ receive"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad2ae11581fad6e818ed8bfe1a31d5635}{ECORE\_GETOPT\_STORE\_TRUE}}(\textcolor{charliteral}{'f'},\ \textcolor{stringliteral}{"{}flush"{}},\ \textcolor{stringliteral}{"{}Force\ a\ flush\ after\ every\ send\ call."{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad2ae11581fad6e818ed8bfe1a31d5635}{ECORE\_GETOPT\_STORE\_TRUE}}(\textcolor{charliteral}{'m'},\ \textcolor{stringliteral}{"{}single-\/message"{}},\ \textcolor{stringliteral}{"{}Send\ a\ single\ message\ and\ delete\ the\ client."{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga87a9d063b60f7c0bd79ab3fa16bb6313}{ECORE\_GETOPT\_VERSION}}(\textcolor{charliteral}{'V'},\ \textcolor{stringliteral}{"{}version"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gac2fdfddf0778a319aafb547b04bc93b6}{ECORE\_GETOPT\_COPYRIGHT}}(\textcolor{charliteral}{'C'},\ \textcolor{stringliteral}{"{}copyright"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga5a0382c58582308ff65d51c14dc1b36f}{ECORE\_GETOPT\_LICENSE}}(\textcolor{charliteral}{'L'},\ \textcolor{stringliteral}{"{}license"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gad7e09a56d2881f22d69dff005e38b67d}{ECORE\_GETOPT\_HELP}}(\textcolor{charliteral}{'h'},\ \textcolor{stringliteral}{"{}help"{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga4950beb14005c6d864915646dfe28fe2}{ECORE\_GETOPT\_STORE\_METAVAR\_STR}}(0,\ NULL,\ \textcolor{stringliteral}{"{}The\ server\ name."{}},\ \textcolor{stringliteral}{"{}name"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga3dcc251323cdd0155b24341bf7bf1347}{ECORE\_GETOPT\_STORE\_METAVAR\_INT}}(0,\ NULL,\ \textcolor{stringliteral}{"{}The\ server\ port."{}},\ \textcolor{stringliteral}{"{}port"{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gaf652ac6007cd9674df603fa3dacc59e0}{ECORE\_GETOPT\_SENTINEL}}}
\DoxyCodeLine{\ \ \}}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ **argv)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Ecore\_Con\_Type\ type;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *name\ =\ NULL;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *type\_choice\ =\ NULL;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ clients\_limit\ =\ -\/1;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ port\ =\ -\/1;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ socket\_activated\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ clients\_reject\_excess\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ quit\_option\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{union__Ecore__Getopt__Value}{Ecore\_Getopt\_Value}}\ values[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga123b1c8494301b8f76554675e8606d94}{ECORE\_GETOPT\_VALUE\_STR}}(type\_choice),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(socket\_activated),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga048498f4546a0dd78c541168db62494e}{ECORE\_GETOPT\_VALUE\_INT}}(clients\_limit),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(clients\_reject\_excess),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(echo),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(do\_flush),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(single\_message),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{comment}{/*\ standard\ block\ to\ provide\ version,\ copyright,\ license\ and\ help\ */}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(quit\_option),\ \textcolor{comment}{/*\ -\/V/-\/-\/version\ quits\ */}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(quit\_option),\ \textcolor{comment}{/*\ -\/C/-\/-\/copyright\ quits\ */}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(quit\_option),\ \textcolor{comment}{/*\ -\/L/-\/-\/license\ quits\ */}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(quit\_option),\ \textcolor{comment}{/*\ -\/h/-\/-\/help\ quits\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{comment}{/*\ positional\ argument\ */}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga123b1c8494301b8f76554675e8606d94}{ECORE\_GETOPT\_VALUE\_STR}}(name),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga048498f4546a0dd78c541168db62494e}{ECORE\_GETOPT\_VALUE\_INT}}(port),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga0440d57be0af2a77dc5de02be19aeae2}{ECORE\_GETOPT\_VALUE\_NONE}}\ \textcolor{comment}{/*\ sentinel\ */}}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ args;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga80f90f9716013d6104624c2e606f8915}{Ecore\_Con\_Server}}\ *svr;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Lib__Group_ga8a20f47372627a03e86a8705a6f8a82d}{ecore\_con\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ args\ =\ \mbox{\hyperlink{group__Ecore__Getopt__Group_gab9fb5bf2f2edd9bd3a3519faa8e3ebfa}{ecore\_getopt\_parse}}(\&options,\ values,\ argc,\ argv);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (args\ <\ 0)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fputs(\textcolor{stringliteral}{"{}ERROR:\ Could\ not\ parse\ command\ line\ options.\(\backslash\)n"{}},\ stderr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (quit\_option)\ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ args\ =\ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga9870510212af9a71d94fc0f8461cff79}{ecore\_getopt\_parse\_positional}}(\&options,\ values,\ argc,\ argv,\ args);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (args\ <\ 0)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fputs(\textcolor{stringliteral}{"{}ERROR:\ Could\ not\ parse\ positional\ arguments.\(\backslash\)n"{}},\ stderr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!type\_choice)\ type\_choice\ =\ \textcolor{stringliteral}{"{}tcp"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}tcp"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_REMOTE\_TCP;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}udp"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_REMOTE\_UDP;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}ssl"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_REMOTE\_TCP\ |\ ECORE\_CON\_USE\_MIXED\ |\ ECORE\_CON\_LOAD\_CERT;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}tcp+ssl"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ type\ =\ ECORE\_CON\_REMOTE\_TCP;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ do\_ssl\_upgrade\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}local-\/user"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_LOCAL\_USER;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}local-\/system"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_LOCAL\_SYSTEM;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}mcast"{}})\ ==\ 0)}
\DoxyCodeLine{\ \ \ \ \ type\ =\ ECORE\_CON\_REMOTE\_MCAST;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ unsupported\ -\/-\/type/-\/t\ '\%s'\(\backslash\)n"{}},\ type\_choice);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (socket\_activated)\ type\ |=\ ECORE\_CON\_SOCKET\_ACTIVATE;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ svr\ =\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga8993f75b5a4948b6b3975575d807fb21}{ecore\_con\_server\_add}}(type,\ name,\ port,\ NULL);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!svr)\ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ ((strcmp(type\_choice,\ \textcolor{stringliteral}{"{}ssl"{}})\ ==\ 0)}
\DoxyCodeLine{\#\textcolor{keywordflow}{if}\ 1}
\DoxyCodeLine{\ \ \ \ \ \ \ \textcolor{comment}{/*\ This\ just\ works\ since\ EFL\ v\ 1.19.\ \ Prior\ to\ this,\ loading\ a}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ certificate\ would\ put\ the\ whole\ server\ in\ SSL\ mode,\ which\ is}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ unexpected.}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ There\ are\ no\ ecore\_con\_ssl\_client\_cert\_add()\ to\ report\ a\ new}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ certificate\ to\ clients\ (and\ it\ shouldn't,\ as\ it\ would\ be\ too}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ expensive\ to\ setup\ for\ each\ client,\ this\ should\ be\ shared).}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ With\ EFL\ v1.19\ this\ can\ be\ done,\ but\ the\ whole\ setup\ should}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ *\ be\ done\ at\ most\ once\ before\ returning\ to\ the\ main\ loop.}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\ \ \ \ \ \ \ ||\ (strcmp(type\_choice,\ \textcolor{stringliteral}{"{}tcp+ssl"{}})\ ==\ 0)}
\DoxyCodeLine{\#endif}
\DoxyCodeLine{\ \ \ \ \ \ \ )}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Ecore__Con__SSL__Group_gaff32bd112f4176c27590b1a6e2411fde}{ecore\_con\_ssl\_server\_cert\_add}}(svr,\ \textcolor{stringliteral}{"{}server.pem"{}}))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ add\ cert:\ server.pem\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ no\_mainloop;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Ecore__Con__SSL__Group_ga6a20fe4c9602bbe1c0ba8a930f5576e5}{ecore\_con\_ssl\_server\_privkey\_add}}(svr,\ \textcolor{stringliteral}{"{}server.pem"{}}))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ add\ privkey:\ server.pem\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ no\_mainloop;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ client\ connect\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_ga4757b5128fed6457910b996a65577111}{ECORE\_CON\_EVENT\_CLIENT\_ADD}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_add,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ client\ disconnect\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_gab6a527ae1614876cddf4630ff03ae1dc}{ECORE\_CON\_EVENT\_CLIENT\_DEL}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_del,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ receiving\ client\ data\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_gaf909435b89ab32078adc52f0a18c70c7}{ECORE\_CON\_EVENT\_CLIENT\_DATA}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_data,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ that\ notifies\ of\ sent\ data\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_ga4ac0af16e7ed78770548918a174f4211}{ECORE\_CON\_EVENT\_CLIENT\_WRITE}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_write\_,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ that\ notifies\ of\ errors\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_ga3fd273623c51b9df5516c4a722ce92d0}{ECORE\_CON\_EVENT\_CLIENT\_ERROR}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_error,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ that\ notifies\ of\ upgrades\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_gaee7ccf1eb1e09cf8e5d9dc52788eed72}{ECORE\_CON\_EVENT\_CLIENT\_UPGRADE}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_upgrade,\ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ start\ server\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ no\_mainloop:}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ svr\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\ end:}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Lib__Group_ga0e5e01c67f7135e16db0e8f17d087d99}{ecore\_con\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ retval;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 