Add function to calculate number of bytes in frame