|
|
|
|
@ -88,10 +88,12 @@ static inline int find_dlist(str* _n, dlist_t** _d)
|
|
|
|
|
* \param flags contact flags
|
|
|
|
|
* \param part_idx part index
|
|
|
|
|
* \param part_max maximal part
|
|
|
|
|
* \param options GAU_OPT_* bit field
|
|
|
|
|
* \return 0 on success, positive if buffer size was not sufficient, negative on failure
|
|
|
|
|
*/
|
|
|
|
|
static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
unsigned int part_idx, unsigned int part_max)
|
|
|
|
|
unsigned int part_idx, unsigned int part_max,
|
|
|
|
|
unsigned int options)
|
|
|
|
|
{
|
|
|
|
|
static char query_buf[512];
|
|
|
|
|
static str query_str;
|
|
|
|
|
@ -167,7 +169,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
|
|
|
|
|
/* received */
|
|
|
|
|
p = (char*)VAL_STRING(ROW_VALUES(row));
|
|
|
|
|
if ( VAL_NULL(ROW_VALUES(row)) || p==0 || p[0]==0 ) {
|
|
|
|
|
if ( VAL_NULL(ROW_VALUES(row)) || p==0 || p[0]==0 || (options & GAU_OPT_ONLY_CONTACT) ) {
|
|
|
|
|
/* contact */
|
|
|
|
|
p = (char*)VAL_STRING(ROW_VALUES(row)+1);
|
|
|
|
|
if (VAL_NULL(ROW_VALUES(row)+1) || p==0 || p[0]==0) {
|
|
|
|
|
@ -263,10 +265,12 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
* \param flags contact flags
|
|
|
|
|
* \param part_idx part index
|
|
|
|
|
* \param part_max maximal part
|
|
|
|
|
* \param options GAU_OPT_* bit field
|
|
|
|
|
* \return 0 on success, positive if buffer size was not sufficient, negative on failure
|
|
|
|
|
*/
|
|
|
|
|
static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
unsigned int part_idx, unsigned int part_max)
|
|
|
|
|
unsigned int part_idx, unsigned int part_max,
|
|
|
|
|
unsigned int options)
|
|
|
|
|
{
|
|
|
|
|
dlist_t *p;
|
|
|
|
|
urecord_t *r;
|
|
|
|
|
@ -303,7 +307,7 @@ static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
*/
|
|
|
|
|
if ((c->cflags & flags) != flags)
|
|
|
|
|
continue;
|
|
|
|
|
if (c->received.s) {
|
|
|
|
|
if (c->received.s && !(options & GAU_OPT_ONLY_CONTACT)) {
|
|
|
|
|
needed = (int)(sizeof(c->received.len)
|
|
|
|
|
+ c->received.len + sizeof(c->sock)
|
|
|
|
|
+ sizeof(c->cflags) + sizeof(c->path.len)
|
|
|
|
|
@ -398,15 +402,34 @@ static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
* \param flags contact flags
|
|
|
|
|
* \param part_idx part index
|
|
|
|
|
* \param part_max maximal part
|
|
|
|
|
* \param options GAU_OPT_* bit field
|
|
|
|
|
* \return 0 on success, positive if buffer size was not sufficient, negative on failure
|
|
|
|
|
*/
|
|
|
|
|
int get_all_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
unsigned int part_idx, unsigned int part_max)
|
|
|
|
|
int get_all_ucontacts_opt(void *buf, int len, unsigned int flags,
|
|
|
|
|
unsigned int part_idx, unsigned int part_max,
|
|
|
|
|
unsigned int options)
|
|
|
|
|
{
|
|
|
|
|
if (db_mode==DB_ONLY)
|
|
|
|
|
return get_all_db_ucontacts( buf, len, flags, part_idx, part_max);
|
|
|
|
|
return get_all_db_ucontacts( buf, len, flags, part_idx, part_max, options);
|
|
|
|
|
else
|
|
|
|
|
return get_all_mem_ucontacts( buf, len, flags, part_idx, part_max);
|
|
|
|
|
return get_all_mem_ucontacts( buf, len, flags, part_idx, part_max, options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Same asget_all_ucontacts_opt() but without options
|
|
|
|
|
* \param buf target buffer
|
|
|
|
|
* \param len length of buffer
|
|
|
|
|
* \param flags contact flags
|
|
|
|
|
* \param part_idx part index
|
|
|
|
|
* \param part_max maximal part
|
|
|
|
|
* \param options GAU_OPT_* bit field
|
|
|
|
|
* \return 0 on success, positive if buffer size was not sufficient, negative on failure
|
|
|
|
|
*/
|
|
|
|
|
int get_all_ucontacts(void *buf, int len, unsigned int flags,
|
|
|
|
|
unsigned int part_idx, unsigned int part_max)
|
|
|
|
|
{
|
|
|
|
|
return get_all_ucontacts_opt(buf, len, flags, part_idx, part_max, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|