speed_t tcgetspeed(tcstype_t type, const struct termios *termios_p);
void tcsetspeed(tcstype_t type, struct termios *termios_p, speed_t speed);
The input and output baud rates are stored in the termios structure.
The baud rates that can be represented in a termios structure are
implementation specific, but include at least the following:
0, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
A baud rate of zero has a special interpretation. It it used to terminate (hang up) a connection.
The baud rate is returned as an integer (for example, 300 is returned for 300 baud). If tcgetspeed is called with TCS_ALL and the input and output baud rates are not the same, it returns zero.
If the output baud rate is set to zero, the modem control lines will be de-asserted. Normally, this disconnects the line. Both baud rates must be set to non-zero values for a useable connection.
Attempts to set baud rates or baud rate combinations not supported by either the termios representation or by the driver are ignored. The previous baud rate setting will remain in effect.
Zeroing all the bytes of a termios structure will have the side effect of setting the output baud rate to zero.