if (data == NULL)
len = used = 0;
+ iter->cursor = longhdr ? 4 : 2;
iter->start = (uint8_t *)data + used;
iter->end = iter->start + len;
iter->longhdr = longhdr;
if (data == NULL)
len = used = 0;
+ iter->cursor = 2;
iter->start = (uint8_t *)data + used;
iter->end = iter->start + len;
iter->longhdr = FALSE;
outer->start + used > outer->end)
len = used = 0;
+ inner->cursor = 2;
inner->start = outer->start + used;
inner->end = inner->start + len;
inner->longhdr = FALSE;
outer->start + used > outer->end)
len = used = 0;
+ inner->cursor = longhdr ? 4 : 2;
inner->start = outer->start + used;
inner->end = inner->start + len;
inner->longhdr = longhdr;
return TRUE;
}
+gboolean g_isi_sb_iter_eat_byte(GIsiSubBlockIter *restrict iter,
+ uint8_t *byte)
+{
+ if (!g_isi_sb_iter_get_byte(iter, byte, iter->cursor))
+ return FALSE;
+
+ iter->cursor += 1;
+ return TRUE;
+}
+gboolean g_isi_sb_iter_eat_word(GIsiSubBlockIter *restrict iter,
+ uint16_t *word)
+{
+ if (!g_isi_sb_iter_get_word(iter, word, iter->cursor))
+ return FALSE;
+
+ iter->cursor += 2;
+ return TRUE;
+}
+
+gboolean g_isi_sb_iter_eat_dword(GIsiSubBlockIter *restrict iter,
+ uint32_t *dword)
+{
+ if (!g_isi_sb_iter_get_dword(iter, dword, iter->cursor))
+ return FALSE;
+
+ iter->cursor += 4;
+ return TRUE;
+}
+
gboolean g_isi_sb_iter_get_oper_code(const GIsiSubBlockIter *restrict iter,
char *mcc, char *mnc, unsigned pos)
{
return TRUE;
}
+gboolean g_isi_sb_iter_eat_oper_code(GIsiSubBlockIter *restrict iter,
+ char *mcc, char *mnc)
+{
+ if (!g_isi_sb_iter_get_oper_code(iter, mcc, mnc, iter->cursor))
+ return FALSE;
+
+ iter->cursor += 3;
+ return TRUE;
+}
+
gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
char **utf8, size_t len, unsigned pos)
{
return *utf8 != NULL;
}
+gboolean g_isi_sb_iter_eat_alpha_tag(GIsiSubBlockIter *restrict iter,
+ char **utf8, size_t len)
+{
+ if (!g_isi_sb_iter_get_alpha_tag(iter, utf8, len, iter->cursor))
+ return FALSE;
+
+ iter->cursor += len;
+ return TRUE;
+}
gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
char **latin, size_t len, unsigned pos)
{
return *latin != NULL;
}
+gboolean g_isi_sb_iter_eat_latin_tag(GIsiSubBlockIter *restrict iter,
+ char **latin, size_t len)
+{
+ if (!g_isi_sb_iter_get_latin_tag(iter, latin, len, iter->cursor))
+ return FALSE;
+
+ iter->cursor += len;
+ return TRUE;
+}
gboolean g_isi_sb_iter_next(GIsiSubBlockIter *iter)
{
uint8_t len = g_isi_sb_iter_get_len(iter);
if (iter->start + len > iter->end)
return FALSE;
+
+ iter->cursor = iter->longhdr ? 4 : 2;
iter->start += len;
iter->sub_blocks--;
#include "message.h"
struct _GIsiSubBlockIter {
+ uint8_t cursor;
uint8_t *start;
uint8_t *end;
gboolean longhdr;
uint16_t *word, unsigned pos);
gboolean g_isi_sb_iter_get_dword(const GIsiSubBlockIter *restrict iter,
uint32_t *dword, unsigned pos);
+gboolean g_isi_sb_iter_eat_byte(GIsiSubBlockIter *restrict iter,
+ uint8_t *byte);
+gboolean g_isi_sb_iter_eat_word(GIsiSubBlockIter *restrict iter,
+ uint16_t *word);
+gboolean g_isi_sb_iter_eat_dword(GIsiSubBlockIter *restrict iter,
+ uint32_t *dword);
gboolean g_isi_sb_iter_get_oper_code(const GIsiSubBlockIter *restrict iter,
char *mcc, char *mnc, unsigned pos);
+gboolean g_isi_sb_iter_eat_oper_code(GIsiSubBlockIter *restrict iter,
+ char *mcc, char *mnc);
gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
char **utf8, size_t len, unsigned pos);
+gboolean g_isi_sb_iter_eat_alpha_tag(GIsiSubBlockIter *restrict iter,
+ char **utf8, size_t len);
gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
char **ascii, size_t len, unsigned pos);
+gboolean g_isi_sb_iter_eat_latin_tag(GIsiSubBlockIter *restrict iter,
+ char **ascii, size_t len);
gboolean g_isi_sb_iter_get_struct(const GIsiSubBlockIter *restrict iter,
void **ptr, size_t len, unsigned pos);