39 #if XCP_TRANSPORT_LAYER == XCP_ON_ETHERNET 40 static const char OPTION_STR[] =
"htu46p:";
41 #elif XCP_TRANSPORT_LAYER == XCP_ON_CAN 42 static const char OPTION_STR[] =
"hi:f";
48 void parse_options(
int argc,
char** argv, Xcp_OptionsType* options) {
51 #if XCP_TRANSPORT_LAYER == XCP_ON_ETHERNET 52 options->ipv6 = XCP_FALSE;
53 options->tcp = XCP_TRUE;
56 for (idx = 1; idx < argc; ++idx) {
58 if ((arg[0] !=
'/') && (arg[0] !=
'-')) {
63 options->ipv6 = XCP_FALSE;
66 options->ipv6 = XCP_TRUE;
69 options->tcp = XCP_FALSE;
72 options->tcp = XCP_TRUE;
81 #elif defined(TP_BLUETOOTH) 90 printf(
"\nparameter summary: \n");
91 #if XCP_TRANSPORT_LAYER == XCP_ON_ETHERNET 92 printf(
"-h\t this message.\n");
93 printf(
"-t\t TCP\t\t default: TRUE\n");
94 printf(
"-u\t UDP\t\t default: FALSE\n");
95 printf(
"-4\t IPv4\t\t default: TRUE\n");
96 printf(
"-6\t IPv6\t\t default: FALSE\n");
97 printf(
"-p <port> port to listen default: 5555\n");
98 #elif XCP_TRANSPORT_LAYER == XCP_ON_CAN 99 printf(
"-h\tthis message.\n");
100 printf(
"-f\t\tuse CAN-FD\t\tdefault: FALSE\n");
101 printf(
"-i <if-name>\tinterface to use\tdefault: vcan0\n");
106 void parse_options(
int argc,
char** argv, Xcp_OptionsType* options) {
110 #if XCP_TRANSPORT_LAYER == XCP_ON_ETHERNET 114 options->tcp = XCP_TRUE;
115 options->ipv6 = XCP_FALSE;
116 options->port = XCP_ETH_DEFAULT_PORT;
117 #elif XCP_TRANSPORT_LAYER == XCP_ON_CAN 119 options->fd = XCP_FALSE;
122 while ((opt = getopt(argc, argv, OPTION_STR)) != -1) {
128 #if XCP_TRANSPORT_LAYER == XCP_ON_ETHERNET 131 printf(
"-t and -u options are mutual exclusive.\n");
134 p_assigned = XCP_TRUE;
135 options->tcp = XCP_TRUE;
139 printf(
"-t and -u options are mutual exclusive.\n");
142 p_assigned = XCP_TRUE;
143 options->tcp = XCP_FALSE;
147 printf(
"-4 and -6 options are mutual exclusive.\n");
150 v_assigned = XCP_TRUE;
151 options->ipv6 = XCP_FALSE;
155 printf(
"-4 and -6 options are mutual exclusive.\n");
158 v_assigned = XCP_TRUE;
159 options->ipv6 = XCP_TRUE;
162 options->port = atoi(optarg);
163 #elif XCP_TRANSPORT_LAYER == XCP_ON_CAN 165 options->fd = XCP_TRUE;
169 strcpy(options->interface, optarg);
175 #if XCP_TRANSPORT_LAYER == XCP_ON_CAN 177 strcpy(options->interface, XCP_SOCKET_CAN_DEFAULT_IF);