|
RCOM PROJ
File transfer via serial port
|
Enumerations | |
| enum | readingType { openR, readR, closeDISC, closeUA } |
| enum | writingType { trans_SET, writeR, trans_DISC_UA } |
Functions | |
| int | readingCycle (enum readingType type, int fd, unsigned char *c, unsigned char **dataBuf, int *retBufferSize) |
| Function to read a byte from fd. More... | |
| int | writeCycle (enum writingType type, int fd, unsigned char *buf, int bufsize) |
| Function used to write to fd. More... | |
| int | initConnection (int *fd, char *port) |
| Estabelece ligação ao cabo e cria fd. More... | |
| void | atende () |
| Função handler do sinal de alarme. More... | |
| int | transmitter_SET (int fd) |
| Função que envia Trama SET e recebe trama UA. More... | |
| int | receiver_UA (int fd) |
| Função que recebe trama SET e envia trama UA. More... | |
| int | fillFinalBuffer (unsigned char *finalBuffer, unsigned char *headerBuf, unsigned char *footerBuf, int footerBufSize, unsigned char *dataBuffer, int dataSize) |
| Stuffs the final buffer with the Information Packet. More... | |
| int | transmitter_DISC_UA (int fd) |
| Transmitter sequence to Disconnect. More... | |
| int | receiver_DISC_UA (int fd) |
| Receiver sequence to Disconnect. More... | |
| void | generateErrorBCC2 (unsigned char *frame, int frameSize) |
| Generates a error on BCC2 based on PROBABILITY_BCC2. More... | |
| void | generateErrorBCC1 (unsigned int *checkBuffer) |
| Generates a error on BCC based on PROBABILITY_BCC2. More... | |
Variables | |
| int | testSend1 =0 |
| enum readingType |
| enum writingType |
| void atende | ( | ) |
Função handler do sinal de alarme.
References DONE, failed, log_caution(), stateMachineParams::state, state_machine, and TRUE.
Referenced by llopen().


| int fillFinalBuffer | ( | unsigned char * | finalBuffer, |
| unsigned char * | headerBuf, | ||
| unsigned char * | footerBuf, | ||
| int | footerBufSize, | ||
| unsigned char * | dataBuffer, | ||
| int | dataSize | ||
| ) |
Stuffs the final buffer with the Information Packet.
| finalBuffer | pointer to the Information buffer |
| headerBuf | pointer to the header buffer [FLAG, A, C, BCC1] |
| footerBuf | pointer to the footer buffer [BCC2, FLAG] |
| footerBufSize | size of footer buffer |
| dataBuffer | pointer to the Data Buffer [D1, D2, ..., Dn] |
| dataSize | size of Data Buffer |
Referenced by llwrite().

| void generateErrorBCC1 | ( | unsigned int * | checkBuffer | ) |
Generates a error on BCC based on PROBABILITY_BCC2.
| checkBuffer | Buffer with Address Byte and Control Byte to generate error on |
References checkBuffer, log_message(), and PROBABILITY_BCC1.
Referenced by processC_RCV().


| void generateErrorBCC2 | ( | unsigned char * | frame, |
| int | frameSize | ||
| ) |
Generates a error on BCC2 based on PROBABILITY_BCC2.
| frame | frame to generate error on |
| frameSize | size of frame |
References log_message(), and PROBABILITY_BCC2.
Referenced by processBCC_OK().


| int initConnection | ( | int * | fd, |
| char * | port | ||
| ) |
Estabelece ligação ao cabo e cria fd.
| fd | file descriptor da ligação |
| port | "/dev/ttySx" |
References ATTEMPTS, BAUDRATE, linkLayer::baudRate, log_error(), log_success(), linkLayer::numTransmissions, oldtio, linkLayer::port, linkLayer::sequenceNumber, TIME_OUT, and linkLayer::timeout.
Referenced by llopen().


| int readingCycle | ( | enum readingType | type, |
| int | fd, | ||
| unsigned char * | c, | ||
| unsigned char ** | dataBuf, | ||
| int * | retBufferSize | ||
| ) |
Function to read a byte from fd.
| type | variable to distinguish warning messages |
| fd | file descriptor |
| c | controll byte, used with type readR |
| dataBuf | buffer to read data, used with type readR |
| retBufferSize | variable to store dataBuf size, used with type readR |
References C_REJ, C_RR, closeDISC, closeUA, DONE, FALSE, log_caution(), log_error(), openR, readR, linkLayer::sequenceNumber, stateMachineParams::state, state_machine, stateMachine(), and TRUE.
Referenced by llread(), receiver_DISC_UA(), and receiver_UA().


| int receiver_DISC_UA | ( | int | fd | ) |
Receiver sequence to Disconnect.
| fd | file descriptor ot the connection |
References A_ER, A_RE, BCC, C_DISC, C_UA, closeDISC, FLAG, log_error(), readingCycle(), Start, stateMachineSetUp(), SU_FRAME_SIZE, Supervision, and linkLayer::timeout.
Referenced by llclose().


| int receiver_UA | ( | int | fd | ) |
Função que recebe trama SET e envia trama UA.
| fd | identificador da ligação de dados |
References A_ER, BCC, C_SET, C_UA, FLAG, log_error(), openR, readingCycle(), Start, stateMachineSetUp(), SU_FRAME_SIZE, and Supervision.
Referenced by llopen().


| int transmitter_DISC_UA | ( | int | fd | ) |
Transmitter sequence to Disconnect.
| fd | file descriptor ot the connection |
References A_ER, A_RE, BCC, C_DISC, C_UA, failed, FLAG, log_error(), Start, stateMachineSetUp(), SU_FRAME_SIZE, Supervision, trans_DISC_UA, TRUE, and writeCycle().
Referenced by llclose().


| int transmitter_SET | ( | int | fd | ) |
Função que envia Trama SET e recebe trama UA.
| fd | identificador da ligação de dados |
References A_ER, BCC, C_SET, C_UA, failed, FLAG, log_error(), Start, stateMachineSetUp(), SU_FRAME_SIZE, Supervision, trans_SET, TRUE, and writeCycle().
Referenced by llopen().


| int writeCycle | ( | enum writingType | type, |
| int | fd, | ||
| unsigned char * | buf, | ||
| int | bufsize | ||
| ) |
Function used to write to fd.
| type | variable to distinguish warning messages |
| fd | file descriptor |
| buf | buffer of content to write |
| bufsize | lenght of buffer in bytes |
References DONE, failed, FALSE, log_caution(), log_error(), linkLayer::numTransmissions, Start, stateMachineParams::state, state_machine, stateMachine(), linkLayer::timeout, trans_DISC_UA, trans_SET, TRUE, and writeR.
Referenced by llwrite(), transmitter_DISC_UA(), and transmitter_SET().


| int testSend1 =0 |