Commit Graph

11 Commits (e649b6ee2a20c5c7ad3e270b24a813f1a78d1a46)

Author SHA1 Message Date
Oleksij Rempel e649b6ee2a libj1939: add libj1939_parse_canaddr and reuse it by testj1939
this function will be needed jcat

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2019-01-04 13:00:33 +01:00
Bastian Stender 54ff81cc40 testj1939: add omit bind option
This option is needed for j1939 socket functionality test.
Connects wihout bind should not work.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2018-09-21 11:31:22 +02:00
Bastian Stender 1ba9b86451 testj1939: add re-bind support
This option is needed for j1939 socket functionality test.
Binding to a socket and rebinding to the socket with e.g. a different SA
should work.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
2018-09-21 11:31:04 +02:00
Bastian Stender 1f3f2f6163 testj1939: use address to string function from libj1939
canaddr2str() from testj1939 and libj1939's libj1939_addr2str provide
the same functionality. Remove the local helper function and use
libj1939_addr2str instead.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
2018-01-22 12:27:15 +01:00
Bastian Stender 680d5c30c3 testj1939: initialize verbose variable
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-01-18 14:53:43 +01:00
Marc Kleine-Budde 07daafc825 testj1939: fix warning on 32 bit systems
testj1939.c: In function 'main':
testj1939.c:201:3: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
   fprintf(stderr, "- bind(, %s, %li);\n", canaddr2str(&sockname), sizeof(sockname));
   ^
testj1939.c:210:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
    fprintf(stderr, "- connect(, %s, %li);\n", canaddr2str(&peername), sizeof(peername));
    ^
testj1939.c:228:5: warning: format '%li' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
     fprintf(stderr, "- sendto(, <dat>, %i, 0, %s, %li);\n", todo_send, canaddr2str(&peername), sizeof(peername));
     ^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
    fprintf(stderr, "- recvfrom(, <dat>, %li, 0, &<peername>, %li);\n", sizeof(peername), sizeof(peername));
    ^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]

Use 'z' as correct modifier to print sizeof().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2016-10-04 14:24:49 +02:00
Kurt Van Dijck 1ffa9a16a4 testj1939: add -w option to keep program open 2016-02-23 09:51:16 +01:00
Kurt Van Dijck 75dfd666c4 testj1939: print API calls 2013-11-28 10:58:59 +01:00
Kurt Van Dijck 854f47fa84 testj1939: use send() when connect()ed
When using connect(), don't re-use the peername but use send() without
destination information
2013-11-20 11:21:07 +01:00
Kurt Van Dijck d66e6ce4ee testj1939: remember if peername was provided
When peername was not provided, the program uses send() rather than
sendto() so the API calls are better demonstrated
2013-11-20 11:21:07 +01:00
Kurt Van Dijck 198c5801ec import sample program & help page 2013-11-20 11:14:44 +01:00