+ srd_err("Protocol decoder %s submitted annotation list, but "
+ "second element was not a list.", di->decoder->name);
+ return SRD_ERR_PYTHON;
+ }
+ if (py_strseq_to_char(py_tmp, &ann_text) != SRD_OK) {
+ srd_err("Protocol decoder %s submitted annotation list, but "
+ "second element was malformed.", di->decoder->name);
+ return SRD_ERR_PYTHON;
+ }
+
+ if (!(pda = g_try_malloc(sizeof(struct srd_proto_data_annotation))))
+ return SRD_ERR_MALLOC;
+ pda->ann_class = ann_class;
+ pda->ann_text = ann_text;
+ pdata->data = pda;
+
+ return SRD_OK;
+}
+
+static int convert_binary(struct srd_decoder_inst *di, PyObject *obj,
+ struct srd_proto_data *pdata)
+{
+ struct srd_proto_data_binary *pdb;
+ PyObject *py_tmp;
+ Py_ssize_t size;
+ int bin_class;
+ char *class_name, *buf;
+
+ /* Should be a tuple of (binary class, bytes). */
+ if (!PyTuple_Check(obj)) {
+ srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY with "
+ "%s instead of tuple.", di->decoder->name,
+ obj->ob_type->tp_name);
+ return SRD_ERR_PYTHON;
+ }
+
+ /* Should have 2 elements. */
+ if (PyTuple_Size(obj) != 2) {
+ srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple "
+ "with %d elements instead of 2", di->decoder->name,
+ PyList_Size(obj));