forked from osmocom/wireshark
Use tab indentation as elsewhere in the files.
Only whitespace changes. svn path=/trunk/; revision=41110
This commit is contained in:
parent
3d0ac5c69a
commit
e485ac5175
30
pcapio.c
30
pcapio.c
|
@ -396,35 +396,35 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
|
||||
block_total_length = sizeof(struct idb) + sizeof(guint32);
|
||||
/* OPT_COMMENT */
|
||||
if ((comment)&&(strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) {
|
||||
if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) {
|
||||
block_total_length += sizeof(struct option) +
|
||||
(guint16)(ADD_PADDING(strlen(comment) + 1));
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* IDB_DESCRIPTION */
|
||||
if ((descr)&&(strlen(descr) > 0) && (strlen(descr) < G_MAXUINT16)) {
|
||||
if ((descr != NULL) && (strlen(descr) > 0) && (strlen(descr) < G_MAXUINT16)) {
|
||||
block_total_length += sizeof(struct option) +
|
||||
(guint16)(ADD_PADDING(strlen(descr) + 1));
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* IDB_NAME */
|
||||
if ((name)&&(strlen(name) > 0) && (strlen(name) < G_MAXUINT16)) {
|
||||
if ((name != NULL) && (strlen(name) > 0) && (strlen(name) < G_MAXUINT16)) {
|
||||
block_total_length += sizeof(struct option) +
|
||||
(guint16)(ADD_PADDING(strlen(name) + 1));
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* IDB_FILTER */
|
||||
if ((filter)&&(strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
|
||||
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
|
||||
block_total_length += sizeof(struct option) +
|
||||
(guint16)(ADD_PADDING(strlen(filter) + 1));
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* IDB_OS */
|
||||
if ((os)&&(strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) {
|
||||
if ((os != NULL) && (strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) {
|
||||
block_total_length += sizeof(struct option) +
|
||||
(guint16)(ADD_PADDING(strlen(os) + 1));
|
||||
have_options = TRUE;
|
||||
|
@ -435,15 +435,18 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
block_total_length += sizeof(struct option) + sizeof(guint64);
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* IDB_TSRESOL 9 */
|
||||
if (tsresol != 0) {
|
||||
block_total_length += sizeof(struct option) + sizeof(struct option);
|
||||
have_options = TRUE;
|
||||
}
|
||||
|
||||
/* If we have options add size of end-of-options */
|
||||
if (have_options) {
|
||||
block_total_length += sizeof(struct option);
|
||||
}
|
||||
|
||||
/* write block header */
|
||||
idb.block_type = INTERFACE_DESCRIPTION_BLOCK_TYPE;
|
||||
idb.block_total_length = block_total_length;
|
||||
|
@ -451,8 +454,9 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
idb.reserved = 0;
|
||||
idb.snap_len = snap_len;
|
||||
WRITE_DATA(fp, &idb, sizeof(struct idb), *bytes_written, err);
|
||||
|
||||
/* write comment string if applicable */
|
||||
if ((comment)&&(strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) {
|
||||
if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) {
|
||||
option.type = OPT_COMMENT;
|
||||
option.value_length = (guint16)(strlen(comment) + 1);
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
|
@ -461,8 +465,9 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
WRITE_DATA(fp, &padding, 4 - (strlen(comment) + 1) % 4 , *bytes_written, err);
|
||||
}
|
||||
}
|
||||
|
||||
/* write interface name string if applicable */
|
||||
if ((name)&&(strlen(name) > 0) && (strlen(name) < G_MAXUINT16)) {
|
||||
if ((name != NULL) && (strlen(name) > 0) && (strlen(name) < G_MAXUINT16)) {
|
||||
option.type = IDB_NAME;
|
||||
option.value_length = (guint16)(strlen(name) + 1);
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
|
@ -471,8 +476,9 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
WRITE_DATA(fp, &padding, 4 - (strlen(name) + 1) % 4 , *bytes_written, err);
|
||||
}
|
||||
}
|
||||
|
||||
/* write interface description string if applicable */
|
||||
if ((descr)&&(strlen(descr) > 0) && (strlen(descr) < G_MAXUINT16)) {
|
||||
if ((descr != NULL) && (strlen(descr) > 0) && (strlen(descr) < G_MAXUINT16)) {
|
||||
option.type = IDB_DESCRIPTION;
|
||||
option.value_length = (guint16)(strlen(descr) + 1);
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
|
@ -481,8 +487,9 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
WRITE_DATA(fp, &padding, 4 - (strlen(descr) + 1) % 4 , *bytes_written, err);
|
||||
}
|
||||
}
|
||||
|
||||
/* write filter string if applicable */
|
||||
if ((filter)&&(strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
|
||||
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
|
||||
option.type = IDB_FILTER;
|
||||
option.value_length = (guint16)(strlen(filter) + 1);
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
|
@ -493,7 +500,7 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
}
|
||||
|
||||
/* write os string if applicable */
|
||||
if ((os)&&(strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) {
|
||||
if ((os != NULL) && (strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) {
|
||||
option.type = IDB_OS;
|
||||
option.value_length = (guint16)(strlen(filter) + 1);
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
|
@ -503,7 +510,6 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* IDB_IF_SPEED 8 */
|
||||
if (if_speed != 0) {
|
||||
option.type = IDB_IF_SPEED;
|
||||
|
@ -511,6 +517,7 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
WRITE_DATA(fp, &if_speed, sizeof(guint64), *bytes_written, err);
|
||||
}
|
||||
|
||||
/* IDB_TSRESOL 9 */
|
||||
if (tsresol != 0) {
|
||||
option.type = IDB_TSRESOL;
|
||||
|
@ -526,6 +533,7 @@ libpcap_write_interface_description_block(FILE *fp,
|
|||
option.value_length = 0;
|
||||
WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
|
||||
}
|
||||
|
||||
/* write the trailing Block Total Length */
|
||||
WRITE_DATA(fp, &block_total_length, sizeof(guint32), *bytes_written, err);
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue