/*! * \brief Insert a new record into domain in memory * \param _d domain the record belongs to * \param _aor address of record * \param _r new created record * \return 0 on success, -1 on failure */ int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r) { int sl; if (new_urecord(_d->name, _aor, _r) < 0) { LM_ERR("creating urecord failed\n"); return -1; } sl = ((*_r)->aorhash)&(_d->size-1); slot_add(&_d->table[sl], *_r); update_stat( _d->users, 1); return 0; }
/* * Insert a new record into domain */ int mem_insert_urecord(udomain_t* _d, str* _uid, struct urecord** _r) { int sl; if (new_urecord(_d->name, _uid, _r) < 0) { LOG(L_ERR, "insert_urecord(): Error while creating urecord\n"); return -1; } sl = hash_func(_d, (unsigned char*)_uid->s, _uid->len); slot_add(&_d->table[sl], *_r); udomain_add(_d, *_r); _d->users++; return 0; }