\doxysection{ecore\+\_\+con\+\_\+client\+\_\+example.\+c}
\hypertarget{ecore_con_client_example_8c-example}{}\label{ecore_con_client_example_8c-example}Shows how to write a simple client (dialer that connects to the example server using \doxylink{group__Ecore__Con__Server__Group_gab1bc5a7692c3c36af00e1ac1db257e98}{ecore\+\_\+con\+\_\+server\+\_\+connect()}.

Shows how to write a simple client (dialer that connects to the example server using \doxylink{group__Ecore__Con__Server__Group_gab1bc5a7692c3c36af00e1ac1db257e98}{ecore\+\_\+con\+\_\+server\+\_\+connect()}.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//\ gcc\ -\/o\ ecore\_con\_client\_example\ ecore\_con\_client\_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\ client\ example}}
\DoxyCodeLine{\textcolor{comment}{\ *\ 2010\ Mike\ Blumenkrantz}}
\DoxyCodeLine{\textcolor{comment}{\ */}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ Ecore\_Con\_Server\ *svr;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ retval\ =\ EXIT\_SUCCESS;}
\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}}\ verify\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ hostname\_verify\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\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{\textcolor{keyword}{static}\ \textcolor{keywordtype}{char}\ *starttls\_local\_command\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_setup\_ssl(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__Iterator}{Eina\_Iterator}}\ *it;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *ca;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!(it\ =\ \mbox{\hyperlink{group__Eina__File__Group_gab744fcd8eb2369fed66520ff82930650}{eina\_file\_ls}}(\textcolor{stringliteral}{"{}/etc/ssl/certs"{}})))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{/*\ add\ all\ the\ CAs\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_gac7314580e18868ef229f5d2814562794}{EINA\_ITERATOR\_FOREACH}}(it,\ ca)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Ecore__Con__SSL__Group_gad1ea485fd7af231d9b817ed5f58333b9}{ecore\_con\_ssl\_server\_cafile\_add}}(svr,\ ca))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}WARNING:\ could\ not\ load\ CA:\ \%s!\(\backslash\)n"{}},\ ca);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga5538b4a134987b8a01744fad1a845ba4}{eina\_stringshare\_del}}(ca);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_ga50da005e8d26c0a043d0d1c025bc9008}{eina\_iterator\_free}}(it);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (verify)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__SSL__Group_gae847bf08f3d0f9b8ae8241bb9dae0902}{ecore\_con\_ssl\_server\_verify}}(svr);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (hostname\_verify)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__SSL__Group_ga35f3bc4a92bcf8894c33065a3b94a5d5}{ecore\_con\_ssl\_server\_verify\_basic}}(svr);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_on\_stdin(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\_Fd\_Handler}}\ *fdh\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *line\ =\ NULL;}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifdef\ \_WIN32}}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ lbuf[4096]\ =\ \textcolor{stringliteral}{"{}"{}};}
\DoxyCodeLine{\ \ \ ssize\_t\ r;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (fgets(lbuf,\ \textcolor{keyword}{sizeof}(lbuf),\ stdin)\ ==\ NULL)}
\DoxyCodeLine{\ \ \ \ \ r\ =\ -\/1;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ line\ =\ strdup(lbuf);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ r\ =\ strlen(line);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{size\_t}\ len\ =\ 0;}
\DoxyCodeLine{\ \ \ ssize\_t\ r\ =\ getline(\&line,\ \&len,\ stdin);}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (r\ <\ 0)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}ERROR:\ could\ not\ read\ from\ stdin:\ \%s\(\backslash\)n"{}},\ strerror(errno));}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL}};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!svr)}
\DoxyCodeLine{\ \ \ \ \ fputs(\textcolor{stringliteral}{"{}WARNING:\ not\ connected\ to\ server,\ ignored\ input.\(\backslash\)n"{}},\ stderr);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordtype}{size\_t}\ clen\ =\ strlen(starttls\_local\_command);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (do\_ssl\_upgrade\ \&\&\ ((\textcolor{keywordtype}{size\_t})r\ >\ clen)\ \&\&}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ (strncmp(line,\ starttls\_local\_command,\ clen)\ ==\ 0)\ \&\&}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ (line[clen]\ ==\ \textcolor{charliteral}{'\(\backslash\)n'}\ ||\ line[clen]\ ==\ \textcolor{charliteral}{'\(\backslash\)r'}))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ starting\ SSL\ communication...\(\backslash\)n"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Ecore__Con__SSL__Group_ga79e98a738901760ba342f9c4927986f4}{ecore\_con\_ssl\_server\_upgrade}}(svr,\ ECORE\_CON\_USE\_MIXED\ |\ ECORE\_CON\_LOAD\_CERT))}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}ERROR:\ failed\ to\ upgrade\ to\ SSL!\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#if\ 1}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ This\ just\ works\ since\ EFL\ v\ 1.19.\ \ Prior\ to\ this,}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ *\ upgrade\ couldn't\ get\ any\ extra\ setup,\ such\ as}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ *\ certificate\ or\ verification\ mode\ as\ OpenSSL\ would}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ *\ complain.}}
\DoxyCodeLine{\textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (!\_setup\_ssl())}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ retval\ =\ EXIT\_FAILURE;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ svr\ =\ NULL;\ \textcolor{comment}{/*\ it's\ considered\ dead\ until\ ECORE\_CON\_EVENT\_SERVER\_UPGRADE\ */}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ end;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_gad01efce916804c31f6b2adcc6f607c6b}{ecore\_con\_server\_send}}(svr,\ line,\ r);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ sent\ \%zd\ bytes\ to\ server.\(\backslash\)n"{}},\ r);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (do\_flush)\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_gac1768fae815fb830a2df13ef08a2e5ae}{ecore\_con\_server\_flush}}(svr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (single\_message)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ svr\ =\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ end:}
\DoxyCodeLine{\ \ \ free(line);}
\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{\_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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Add}{Ecore\_Con\_Event\_Server\_Add}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Server\ with\ ip\ \%s\ connected!\(\backslash\)n"{}},\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga69fe8d9a0423028446b7e2fd873092de}{ecore\_con\_server\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Add_a382a9545ed7fb941a30dc4d598dc7e4d}{server}}));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (do\_ssl\_upgrade)}
\DoxyCodeLine{\ \ \ \ \ printf(\textcolor{stringliteral}{"{}INFO:\ Not\ sending\ 'hello!'\ in\ tcp+ssl\ mode.\ Use:\ \%s\ to\ upgrade\ the\ connection\(\backslash\)n"{}},\ starttls\_local\_command);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_gad01efce916804c31f6b2adcc6f607c6b}{ecore\_con\_server\_send}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Add_a382a9545ed7fb941a30dc4d598dc7e4d}{server}},\ \textcolor{stringliteral}{"{}hello!"{}},\ strlen(\textcolor{stringliteral}{"{}hello!"{}}));}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (do\_flush)\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_gac1768fae815fb830a2df13ef08a2e5ae}{ecore\_con\_server\_flush}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Add_a382a9545ed7fb941a30dc4d598dc7e4d}{server}});}
\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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Del}{Ecore\_Con\_Event\_Server\_Del}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Lost\ server\ with\ ip\ \%s!\(\backslash\)n"{}},\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga69fe8d9a0423028446b7e2fd873092de}{ecore\_con\_server\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Del_a116963b404600e7154c61f94ebf52a2e}{server}}));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ svr\ =\ NULL;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();}
\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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Data}{Ecore\_Con\_Event\_Server\_Data}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Received\ \%i\ bytes\ from\ server:\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}>>>>>\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\%.*s\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}>>>>>\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Data_a41877d1f1cb9792508b9b1d89d53bec2}{size}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Data_a41877d1f1cb9792508b9b1d89d53bec2}{size}},\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *)ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Data_a8d45b6d75c55b26771d241211a0d7e7e}{data}});}
\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{\_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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Write}{Ecore\_Con\_Event\_Server\_Write}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Sent\ \%d\ bytes\ to\ server\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Write_ab6851a4fc081e2c0c6916742427cdab7}{size}});}
\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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Error}{Ecore\_Con\_Event\_Server\_Error}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Server\ Error:\ \%s\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Error_a716e87090f7ec3ef8b7aab9d1ca0c047}{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}},\ \mbox{\hyperlink{struct__Ecore__Con__Event__Server__Upgrade}{Ecore\_Con\_Event\_Server\_Upgrade}}\ *ev)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Server\ upgraded\ to\ SSL\ \%p\ \%s\(\backslash\)n"{}},\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Upgrade_a551692c9afdd9a3b3020b519069e36f3}{server}},\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga69fe8d9a0423028446b7e2fd873092de}{ecore\_con\_server\_ip\_get}}(ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Upgrade_a551692c9afdd9a3b3020b519069e36f3}{server}}));}
\DoxyCodeLine{\ \ \ svr\ =\ ev-\/>\mbox{\hyperlink{struct__Ecore__Con__Event__Server__Upgrade_a551692c9afdd9a3b3020b519069e36f3}{server}};}
\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}{"{}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\_client\_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\_connect()\(\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}}(\textcolor{charliteral}{'P'},\ \textcolor{stringliteral}{"{}no-\/proxy"{}},\ \textcolor{stringliteral}{"{}Do\ not\ use\ SOCKS\ proxy\ for\ remote\ connections."{}}),}
\DoxyCodeLine{}
\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\ server."{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gae6b958516c8e20f7488bac102c4309a9}{ECORE\_GETOPT\_STORE\_STR}}(\textcolor{charliteral}{'c'},\ \textcolor{stringliteral}{"{}starttls-\/local-\/command"{}},\ \textcolor{stringliteral}{"{}The\ string\ to\ use\ as\ a\ local\ command\ (it's\ NOT\ sent\ to\ remote\ peer)\ to\ upgrade\ connections\ when\ -\/t/-\/-\/type=tcp+ssl.\ Defaults\ to\ STARTTLS,\ however\ if\ you\ need\ to\ send\ that\ to\ the\ server,\ change\ the\ string\ with\ this\ option."{}}),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gae0b598e4c27f72b665af7be086e2d4e6}{ECORE\_GETOPT\_STORE\_FALSE}}(0,\ \textcolor{stringliteral}{"{}no-\/verify"{}},\ \textcolor{stringliteral}{"{}Do\ not\ verify\ server's\ certificate"{}}),}
\DoxyCodeLine{\ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_gae0b598e4c27f72b665af7be086e2d4e6}{ECORE\_GETOPT\_STORE\_FALSE}}(0,\ \textcolor{stringliteral}{"{}no-\/hostname-\/verify"{}},\ \textcolor{stringliteral}{"{}Do\ not\ Verify\ server's\ hostname\ based\ on\ its\ certificate."{}}),}
\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{\ \ \ \textcolor{keywordtype}{char}\ *name\ =\ NULL;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *type\_choice\ =\ NULL;}
\DoxyCodeLine{\ \ \ Ecore\_Con\_Type\ type;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ port\ =\ -\/1;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ no\_proxy\ =\ \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}}(no\_proxy),}
\DoxyCodeLine{}
\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{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga123b1c8494301b8f76554675e8606d94}{ECORE\_GETOPT\_VALUE\_STR}}(starttls\_local\_command),}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(verify),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Ecore__Getopt__Group_ga832f91eecd39de313b8351305cba80d3}{ECORE\_GETOPT\_VALUE\_BOOL}}(hostname\_verify),}
\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{}
\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}}
\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}\ ((!starttls\_local\_command)\ ||\ (starttls\_local\_command[0]\ ==\ \textcolor{charliteral}{'\(\backslash\)0'}))}
\DoxyCodeLine{\ \ \ \ \ starttls\_local\_command\ =\ \textcolor{stringliteral}{"{}STARTTLS"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (no\_proxy)\ type\ |=\ ECORE\_CON\_NO\_PROXY;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ svr\ =\ \mbox{\hyperlink{group__Ecore__Con__Server__Group_gab1bc5a7692c3c36af00e1ac1db257e98}{ecore\_con\_server\_connect}}(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{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\_setup\_ssl())}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{goto}\ no\_mainloop;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ server\ connect\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_ga333583a2fbee7c0e3e7fda4a829340be}{ECORE\_CON\_EVENT\_SERVER\_ADD}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_add,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ server\ disconnect\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_ga8577770d5208d3f03d6fbfd1880334ea}{ECORE\_CON\_EVENT\_SERVER\_DEL}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_del,\ NULL);}
\DoxyCodeLine{\textcolor{comment}{/*\ set\ event\ handler\ for\ receiving\ server\ data\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Event__Group_ga886c90c3f917f87b3b4c931adcbc41c5}{ecore\_event\_handler\_add}}(\mbox{\hyperlink{group__Ecore__Con__Events__Group_gac42c3834093f29434298daedd421b2ed}{ECORE\_CON\_EVENT\_SERVER\_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_gadb0aa56cecd64ca8a29710afcefc6b97}{ECORE\_CON\_EVENT\_SERVER\_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_gaf4d788f3487fcbad2e25aa02780b7905}{ECORE\_CON\_EVENT\_SERVER\_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_ga4948a43c81cf05ceee134ba8bdd8786e}{ECORE\_CON\_EVENT\_SERVER\_UPGRADE}},\ (\mbox{\hyperlink{group__Ecore__Event__Group_ga64b4df04cbafda481593d0bc29617c6d}{Ecore\_Event\_Handler\_Cb}})\_upgrade,\ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__FD__Handler__Group_gaf8483e27f0c9fd4a2a7c97fa5539a55f}{ecore\_main\_fd\_handler\_add}}(STDIN\_FILENO,\ \mbox{\hyperlink{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a1699f804eccf88e7e169a4a20f1d44e7}{ECORE\_FD\_READ}},\ \_on\_stdin,\ NULL,\ NULL,\ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/*\ start\ client\ */}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ no\_mainloop:}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (svr)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Ecore__Con__Server__Group_ga2c73087dc4a05e80446a64e7420f87a3}{ecore\_con\_server\_del}}(svr);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ svr\ =\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\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}
 