Lines Matching refs:cookie
41 struct berval *cookie,
65 ber_str2bv_x( cookiestr, len, 1, cookie,
81 cookie->bv_val = slap_sl_malloc( len, op ? op->o_tmpmemctx : NULL );
83 len = sprintf( cookie->bv_val, "rid=%03d,", rid );
84 ptr = cookie->bv_val + len;
99 cookie->bv_len = ptr - cookie->bv_val;
105 struct sync_cookie *cookie,
109 if ( cookie == NULL )
112 if ( cookie->sids ) {
113 ch_free( cookie->sids );
114 cookie->sids = NULL;
117 if ( cookie->ctxcsn ) {
118 ber_bvarray_free( cookie->ctxcsn );
119 cookie->ctxcsn = NULL;
121 cookie->numcsns = 0;
122 if ( !BER_BVISNULL( &cookie->octet_str )) {
123 ch_free( cookie->octet_str.bv_val );
124 BER_BVZERO( &cookie->octet_str );
127 if ( !BER_BVISNULL( &cookie->delcsn )) {
128 ch_free( cookie->delcsn.bv_val );
129 BER_BVZERO( &cookie->delcsn );
133 ch_free( cookie );
272 struct sync_cookie *cookie,
282 if ( cookie == NULL )
285 if ( cookie->octet_str.bv_len <= STRLENOF( "rid=" ) )
288 cookie->rid = -1;
289 cookie->sid = -1;
290 cookie->ctxcsn = NULL;
291 cookie->sids = NULL;
292 cookie->numcsns = 0;
293 BER_BVZERO( &cookie->delcsn );
295 end = cookie->octet_str.bv_val + cookie->octet_str.bv_len;
297 for ( next=cookie->octet_str.bv_val; next < end; ) {
300 cookie->rid = strtol( &rid_ptr[ STRLENOF( "rid=" ) ], &next, 10 );
304 cookie->rid < 0 ||
305 cookie->rid > SLAP_SYNC_RID_MAX )
320 cookie->sid = strtol( &sid_ptr[ STRLENOF( "sid=" ) ], &next, 16 );
324 cookie->sid < 0 ||
325 cookie->sid > SLAP_SYNC_SID_MAX )
366 ber_bvarray_add_x( &cookie->ctxcsn, &bv, memctx );
367 cookie->numcsns++;
412 cookie->delcsn = bv;
425 if ( cookie->numcsns ) {
426 cookie->sids = slap_parse_csn_sids( cookie->ctxcsn, cookie->numcsns,
428 if ( cookie->numcsns > 1 )
429 slap_sort_csn_sids( cookie->ctxcsn, cookie->sids, cookie->numcsns, memctx );
434 /* count the numcsns and regenerate the list of SIDs in a recomposed cookie */
437 struct sync_cookie *cookie,
440 if ( cookie->ctxcsn ) {
441 for (; !BER_BVISNULL( &cookie->ctxcsn[cookie->numcsns] ); cookie->numcsns++);
443 if ( cookie->numcsns ) {
444 cookie->sids = slap_parse_csn_sids( cookie->ctxcsn, cookie->numcsns, NULL );
445 if ( cookie->numcsns > 1 )
446 slap_sort_csn_sids( cookie->ctxcsn, cookie->sids, cookie->numcsns, memctx );
452 struct sync_cookie *cookie
459 if ( cookie == NULL )
466 ch_free( cookie->octet_str.bv_val );
467 ber_dupbv( &cookie->octet_str, &octet_str );
471 cookie->ctxcsn = NULL;
472 value_add_one( &cookie->ctxcsn, &ctxcsn );
473 cookie->numcsns = 1;
474 cookie->sid = -1;
475 BER_BVZERO( &cookie->delcsn );