silc_free(engine);
}
+static const char *packet_error[] = {
+ "Cannot read from stream",
+ "Cannot write to stream",
+ "Packet MAC failed",
+ "Packet decryption failed",
+ "Unknown SID",
+ "Packet is malformed",
+ "System out of memory",
+};
+
+/* Return packet error string */
+
+const char *silc_packet_error_string(SilcPacketError error)
+{
+ if (error < SILC_PACKET_ERR_READ || error > SILC_PACKET_ERR_NO_MEMORY)
+ return "";
+ return packet_error[error];
+}
+
/* Return list of packet streams in the engine */
SilcDList silc_packet_engine_get_streams(SilcPacketEngine engine)
(*src_id).u.channel_id = *(SilcChannelID *)stream->src_id;
break;
}
- if (src_id_set)
- *src_id_set = TRUE;
}
+ if (stream->src_id && src_id_set)
+ *src_id_set = TRUE;
if (dst_id && stream->dst_id) {
(*dst_id).type = stream->dst_id_type;
(*dst_id).u.channel_id = *(SilcChannelID *)stream->dst_id;
break;
}
- if (dst_id_set)
- *dst_id_set = TRUE;
}
+ if (stream->dst_id && dst_id_set)
+ *dst_id_set = TRUE;
return TRUE;
}