Communication device, release method of buffer, and program
A communication device includes at least one memory and at least one processor coupled to the at least one memory. The at least one processor is configured to: secure a transmission buffer that is not optionally released by a user application; monitor a storage area in which a specific field in an upper protocol header included in payload data of a frame transmitted from the transmission buffer is written; and release the transmission buffer in a case where a storage value stored in the storage area has not been updated for a certain period of time.
1 . A communication device comprising:
at least one memory; and
at least one processor coupled to the at least one memory,
wherein the at least one processor is configured to:
allocate a transmission buffer for storing a frame to be transmitted, the transmission buffer not being releasable by a user application unless the frame is transmitted from the transmission buffer;
receive a transmission request from the user application;
transmit the frame from the transmission buffer in response to the transmission request;
monitor a storage area within the transmission buffer to determine whether a storage value stored in the storage area has been updated, the storage area being one in which a specific field in an upper protocol header included in payload data of the frame transmitted from the transmission buffer is written, the storage value being updated when the frame is transmitted; and
release the transmission buffer in a case where the storage value stored in the storage area has not been updated for a certain period of time.
2 . The communication device according to claim 1 , wherein the specific field includes at least one of a field indicating a protocol number in an IP header, a field indicating a header checksum in the IP header, a field indicating a checksum in a TCP header, a field indicating a checksum in a UDP header, and a field indicating a checksum in an ICMP header.
3 . The communication device according to claim 2 , wherein the at least one processor monitors a storage area in which a plurality of the specific fields are written.
4 . The communication device according to claim 1 , wherein the at least one processor is configured to:
periodically monitor whether the storage value is updated;
increment a counter value representing a period during which the storage value has not been updated by a certain amount in a case where the storage value has not been updated, and reset the counter value in a case where the storage value has been updated; and
release the transmission buffer when the counter value is greater than or equal to a threshold.
5 . The communication device according to claim 4 , wherein the threshold is set by the user application.
6 . The communication device according to claim 1 , wherein the at least one processor is configured to:
analyze a type of the upper protocol; and
monitor the storage area according to a type of the upper protocol.
7 . The communication device according to claim 1 , wherein the communication device performs communication according to an AUTOSAR (registered trademark) standard.
8 . The communication device according to claim 7 , wherein the communication device is a gateway electronic control unit (ECU).
9 . A release method of a buffer, the release method comprising:
allocating, using a computer, a transmission buffer for storing a frame to be transmitted, the transmission buffer not being releasable by a user application unless the frame is transmitted from the transmission buffer;
receiving, by the computer, a transmission request from the user application;
transmitting, using the computer, a frame from the transmission buffer in response to the transmission request from the user application;
monitoring, using the computer, a storage area within the transmission buffer to determine whether a storage value stored in the storage area has been updated, the storage area being one in which a specific field in an upper protocol header included in payload data of the frame transmitted from the transmission buffer is written, the storage value being updated when the frame is transmitted; and
releasing, using the computer, the transmission buffer in a case where the storage value stored in the storage area has not been updated for a certain period of time.
10 . A non-transitory computer readable storage medium storing a program for causing a computer to execute a process comprising:
allocating a transmission buffer for storing a frame to be transmitted, the transmission buffer not being releasable by a user application unless the frame is transmitted from the transmission buffer;
receiving a transmission request from the user application;
transmitting the frame form the transmission buffer in response to the transmission request;
monitoring a storage area within the transmission buffer to determine whether a storage value stored in the storage area has been updated, the storage area being one in which a specific field in an upper protocol header included in payload data of the frame transmitted from the transmission buffer is written, the storage value being updated when the frame is transmitted; and
releasing the transmission buffer in a case where the storage value stored in the storage area has not been updated for a certain period of time.