Skip to content

Commit

Permalink
Merge pull request #59 from marckleinebudde/fix-typos
Browse files Browse the repository at this point in the history
treewide: fix typos
  • Loading branch information
marckleinebudde authored Dec 9, 2024
2 parents aa8cf7d + 007910e commit fd6640e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions doc/protocol.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Socketcand protocol
===================

The socketcand provides a network interface to a number of CAN busses on the host. It can be controlled over a single TCP socket and supports transmission and reception of CAN frames. The used protocol is ASCII based and has some states in which different commands may be used.
The socketcand provides a network interface to a number of CAN buses on the host. It can be controlled over a single TCP socket and supports transmission and reception of CAN frames. The used protocol is ASCII based and has some states in which different commands may be used.

## Mode NO_BUS ##
After connecting to the socket the client is greeted with '< hi >'. The open command is used to select one of the CAN busses that were announced in the broadcast beacon. The syntax is '<open canbus>', e.g.
After connecting to the socket the client is greeted with '< hi >'. The open command is used to select one of the CAN buses that were announced in the broadcast beacon. The syntax is '<open canbus>', e.g.

< open can0 >

Expand Down Expand Up @@ -49,7 +49,7 @@ Send the CAN frame 123#42424242 every 20 msecs
#### Update a frame ####
This command updates a frame transmission job that was created via the 'add' command with new content. The transmission timers are not touched

Examle:
Example:
Update the CAN frame 123#42424242 with 123#112233 - no change of timers

< update 123 3 11 22 33 >
Expand Down Expand Up @@ -185,7 +185,7 @@ With '< controlmode >' it is possible to enter the CONTROL mode. Here statistics

#### Statistics ####
In CONTROL mode it is possible to receive bus statistics. Transmission is enabled by the '< statistics ival >' command. Ival is the interval between two statistics transmissions in milliseconds. The ival may be set to '0' to deactivate transmission.
After enabling statistics transmission the data is send inline with normal CAN frames and other data. The daemon takes care of the interval that was specified. The information is transfered in the following format:
After enabling statistics transmission the data is send inline with normal CAN frames and other data. The daemon takes care of the interval that was specified. The information is transferred in the following format:
< stat rbytes rpackets tbytes tpackets >
The reported bytes and packets are reported as unsigned integers.

Expand All @@ -194,7 +194,7 @@ Example for CAN interface 'can0' to enable statistics with interval of one secon
< open can0 >< controlmode >< statistics 1000 >

## Mode ISO-TP ##
A transport protocol, such as ISO-TP, is needed to enable e.g. software updload via CAN. It organises the connection-less transmission of a sequence of data. An ISO-TP channel consists of two exclusive CAN IDs, one to transmit data and the other to receive data.
A transport protocol, such as ISO-TP, is needed to enable e.g. software upload via CAN. It organises the connection-less transmission of a sequence of data. An ISO-TP channel consists of two exclusive CAN IDs, one to transmit data and the other to receive data.
After configuration a single ISO-TP channel can be used. The ISO-TP mode can be used exclusively like the other modes (bcmmode, rawmode, isotpmode).

Switch to ISO-TP mode
Expand All @@ -213,8 +213,8 @@ Configure the ISO-TP channel - optional parameters are in [ ] brackets.
* wftmax - maximum number of wait frames (0 = off)
* txpad_content - padding value in the tx path (enable CAN_ISOTP_TX_PADDING in flags)
* rxpad_content - padding value in the rx path (enable CAN_ISOTP_RX_PADDING in flags)
* ext_address - extended adressing freature (value for tx and rx if not specified separately / enable CAN_ISOTP_EXTEND_ADDR in flags)
* rx_ext_address - extended adressing freature (separate value for rx / enable CAN_ISOTP_RX_EXT_ADDR in flags)
* ext_address - extended addressing freature (value for tx and rx if not specified separately / enable CAN_ISOTP_EXTEND_ADDR in flags)
* rx_ext_address - extended addressing freature (separate value for rx / enable CAN_ISOTP_RX_EXT_ADDR in flags)

The flags contents are built from the original isotp.h file:

Expand Down Expand Up @@ -257,16 +257,16 @@ Example: Receiving of the same data as sent in the example above
Service discovery
-----------------

Because configuration shall be as easy as possible and the virtual CAN bus and the Kayak instance are not necessarily on the same machine a machanism for service discovery is necessary.
Because configuration shall be as easy as possible and the virtual CAN bus and the Kayak instance are not necessarily on the same machine a mechanism for service discovery is necessary.

The server sends a UDP broadcast beacon to port 42000 on the subnet where the server port was bound. The interval for these discovery beacons shall not be longer than three seconds. Because the BCM server handles all communication (even for multiple busses) over a single TCP connection the broadcast must provide information about all busses that are accessible through the BCM server.
The server sends a UDP broadcast beacon to port 42000 on the subnet where the server port was bound. The interval for these discovery beacons shall not be longer than three seconds. Because the BCM server handles all communication (even for multiple buses) over a single TCP connection the broadcast must provide information about all buses that are accessible through the BCM server.

### Content ###

Required:

* Name of the device that provides access to the busses. On linux machines this could be the hostname
* Name of the busses (in case of socketCAN and embedded this should be the same as the device name)
* Name of the device that provides access to the buses. On linux machines this could be the hostname
* Name of the buses (in case of socketCAN and embedded this should be the same as the device name)
* URL with port and IP address. If the server is listening on multiple sockets all of them should be included in the beacon
* Device type the service is running on

Expand Down
2 changes: 1 addition & 1 deletion files/socketcand-init.d.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: socketcand
# Description: daemon that provides network access to local CAN busses
# Description: daemon that provides network access to local CAN buses
### END INIT INFO

[ -f /etc/default/rcS ] && . /etc/default/rcS
Expand Down
6 changes: 3 additions & 3 deletions files/socketcand.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# The port the socketcand is listening on
# port = 29536;

# List of busses the daemon shall provide access to
# Multiple busses must be separated with ',' and whitespace
# List of buses the daemon shall provide access to
# Multiple buses must be separated with ',' and whitespace
# is not allowed. eg "vcan0,vcan1"
busses = "vcan0";

Expand All @@ -15,6 +15,6 @@ busses = "vcan0";
# AF_UNIX name. As alternative to bind to a TCP/IP socket the socketcand can
# listen on an AF_UNIX socket.
# When afuxname starts with a '/' a path for the AF_UNIX socket is created.
# Alternatively an abstact AF_UNIX namespace is allocated with afuxname
# Alternatively an abstract AF_UNIX namespace is allocated with afuxname
# afuxname = "socketcand";

12 changes: 6 additions & 6 deletions src/socketcand.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ int main(int argc, char **argv)
}
}

/* parse busses */
/* parse buses */
for (i = 0;; i++) {
if (busses_string[i] == '\0')
break;
Expand Down Expand Up @@ -352,7 +352,7 @@ int main(int argc, char **argv)
} else {
strcpy(&unaddr.sun_path[1], afuxname);
unaddr.sun_path[0] = 0;
/* abtract name length definition without trailing \0 but with leading \0 */
/* abstract name length definition without trailing \0 but with leading \0 */
unaddrlen = strlen(afuxname) + sizeof(unaddr.sun_family) + 1;
}
PRINT_VERBOSE("binding unix socket to '%s' with unaddrlen %d\n", afuxname, unaddrlen);
Expand Down Expand Up @@ -622,20 +622,20 @@ void determine_adress()

close(probe_socket);

PRINT_VERBOSE("Listen adress is %s\n", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
PRINT_VERBOSE("Listen address is %s\n", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
PRINT_VERBOSE("Netmask is %s\n", inet_ntoa(((struct sockaddr_in *)&ifr_mask.ifr_netmask)->sin_addr));

/* set listen adress */
/* set listen address */
saddr.sin_family = AF_INET;
saddr.sin_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
saddr.sin_port = htons(port);

/* calculate and set broadcast adress */
/* calculate and set broadcast address */
broadcast_addr.sin_family = AF_INET;
broadcast_addr.sin_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
broadcast_addr.sin_addr.s_addr |= ~((struct sockaddr_in *)&ifr_mask.ifr_netmask)->sin_addr.s_addr;
broadcast_addr.sin_port = htons(BROADCAST_PORT);
PRINT_VERBOSE("Broadcast adress is %s\n", inet_ntoa(broadcast_addr.sin_addr));
PRINT_VERBOSE("Broadcast address is %s\n", inet_ntoa(broadcast_addr.sin_addr));
}

void print_usage(void)
Expand Down
2 changes: 1 addition & 1 deletion src/socketcandcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int main(int argc, char **argv)
} else {
strcpy(&serveraddr_un.sun_path[1], afuxname);
serveraddr_un.sun_path[0] = 0;
/* abtract name length definition without trailing \0 but with leading \0 */
/* abstract name length definition without trailing \0 but with leading \0 */
serveraddr_un_len = strlen(afuxname) + sizeof(serveraddr_un.sun_family) + 1;
}

Expand Down

0 comments on commit fd6640e

Please sign in to comment.