Rename replay functions to comply with library name.
diff --git a/crypto/include/cipher.h b/crypto/include/cipher.h
index 7708aca..711fc92 100644
--- a/crypto/include/cipher.h
+++ b/crypto/include/cipher.h
@@ -48,7 +48,7 @@
 
 #include "srtp.h"
 #include "datatypes.h"
-#include "rdbx.h"               /* for xtd_seq_num_t */
+#include "rdbx.h"               /* for srtp_xtd_seq_num_t */
 #include "err.h"                /* for error codes  */
 #include "crypto_types.h"       /* for values of cipher_type_id_t */
 
@@ -89,7 +89,7 @@
 
 /* a cipher_set_segment_func_t sets the segment index of a cipher_t */
 typedef srtp_err_status_t (*cipher_set_segment_func_t)
-    (void *state, xtd_seq_num_t idx);
+    (void *state, srtp_xtd_seq_num_t idx);
 
 /*
  * a cipher_set_aad_func_t processes the AAD data for AEAD ciphers
@@ -121,7 +121,7 @@
 
 
 /*
- * cipher_test_case_t is a (list of) key, salt, xtd_seq_num_t,
+ * cipher_test_case_t is a (list of) key, salt, srtp_xtd_seq_num_t,
  * plaintext, and ciphertext values that are known to be correct for a
  * particular cipher.  this data can be used to test an implementation
  * in an on-the-fly self test of the correcness of the implementation.
@@ -201,7 +201,7 @@
 
 /*
  * cipher_type_self_test() tests a cipher against test cases provided in
- * an array of values of key/xtd_seq_num_t/plaintext/ciphertext
+ * an array of values of key/srtp_xtd_seq_num_t/plaintext/ciphertext
  * that is known to be good
  */
 srtp_err_status_t srtp_cipher_type_self_test(const srtp_cipher_type_t *ct);
@@ -209,7 +209,7 @@
 
 /*
  * cipher_type_test() tests a cipher against external test cases provided in
- * an array of values of key/xtd_seq_num_t/plaintext/ciphertext
+ * an array of values of key/srtp_xtd_seq_num_t/plaintext/ciphertext
  * that is known to be good
  */
 srtp_err_status_t srtp_cipher_type_test(const srtp_cipher_type_t *ct, const srtp_cipher_test_case_t *test_data);
diff --git a/crypto/include/key.h b/crypto/include/key.h
index ad7fe1f..8dddc76 100644
--- a/crypto/include/key.h
+++ b/crypto/include/key.h
@@ -45,7 +45,7 @@
 #ifndef KEY_H
 #define KEY_H
 
-#include "rdbx.h"   /* for xtd_seq_num_t */
+#include "rdbx.h"   /* for srtp_xtd_seq_num_t */
 #include "err.h"
 
 typedef struct srtp_key_limit_ctx_t *srtp_key_limit_t;
@@ -56,7 +56,7 @@
     srtp_key_event_hard_limit
 } srtp_key_event_t;
 
-srtp_err_status_t srtp_key_limit_set(srtp_key_limit_t key, const xtd_seq_num_t s);
+srtp_err_status_t srtp_key_limit_set(srtp_key_limit_t key, const srtp_xtd_seq_num_t s);
 
 srtp_err_status_t srtp_key_limit_clone(srtp_key_limit_t original, srtp_key_limit_t *new_key);
 
@@ -71,7 +71,7 @@
 } srtp_key_state_t;
 
 typedef struct srtp_key_limit_ctx_t {
-    xtd_seq_num_t num_left;
+    srtp_xtd_seq_num_t num_left;
     srtp_key_state_t state;
 } srtp_key_limit_ctx_t;
 
diff --git a/crypto/include/rdb.h b/crypto/include/rdb.h
index 654b1c4..908c815 100644
--- a/crypto/include/rdb.h
+++ b/crypto/include/rdb.h
@@ -21,67 +21,65 @@
  */
 
 typedef struct {
-  uint32_t window_start;   /* packet index of the first bit in bitmask */
-  v128_t bitmask;  
-} rdb_t;
+    uint32_t window_start; /* packet index of the first bit in bitmask */
+    v128_t bitmask;
+} srtp_rdb_t;
 
-#define rdb_bits_in_bitmask (8*sizeof(v128_t))   
+#define rdb_bits_in_bitmask (8 * sizeof(v128_t))
 
 /*
- * rdb init
+ * srtp_rdb_init
  *
  * initalizes rdb
  *
  * returns srtp_err_status_ok on success, srtp_err_status_t_fail otherwise
  */
-srtp_err_status_t rdb_init(rdb_t *rdb);
+srtp_err_status_t srtp_rdb_init(srtp_rdb_t *rdb);
 
 
 /*
- * rdb_check
+ * srtp_rdb_check
  *
  * checks to see if index appears in rdb
  *
  * returns srtp_err_status_fail if the index already appears in rdb,
  * returns srtp_err_status_ok otherwise
  */
-srtp_err_status_t rdb_check(const rdb_t *rdb, uint32_t rdb_index);  
+srtp_err_status_t srtp_rdb_check(const srtp_rdb_t *rdb, uint32_t rdb_index);
 
 /*
- * rdb_add_index
+ * srtp_rdb_add_index
  *
- * adds index to rdb_t (and does *not* check if index appears in db)
+ * adds index to srtp_rdb_t (and does *not* check if index appears in db)
  *
  * returns srtp_err_status_ok on success, srtp_err_status_fail otherwise
  *
  */
-srtp_err_status_t rdb_add_index(rdb_t *rdb, uint32_t rdb_index);
+srtp_err_status_t srtp_rdb_add_index(srtp_rdb_t *rdb, uint32_t rdb_index);
 
 /*
- * the functions rdb_increment() and rdb_get_value() are for use by 
+ * the functions srtp_rdb_increment() and srtp_rdb_get_value() are for use by
  * senders, not receivers - DO NOT use these functions on the same
- * rdb_t upon which rdb_add_index is used!
+ * srtp_rdb_t upon which srtp_rdb_add_index is used!
  */
 
 
 /*
- * rdb_increment(db) increments the sequence number in db, if it is 
+ * srtp_rdb_increment(db) increments the sequence number in db, if it is
  * not too high
  *
  * return values:
- * 
+ *
  *    srtp_err_status_ok            no problem
  *    srtp_err_status_key_expired   sequence number too high
  *
  */
-srtp_err_status_t rdb_increment(rdb_t *rdb);
+srtp_err_status_t srtp_rdb_increment(srtp_rdb_t *rdb);
 
 /*
- * rdb_get_value(db) returns the current sequence number of db
+ * srtp_rdb_get_value(db) returns the current sequence number of db
  */
-
-uint32_t
-rdb_get_value(const rdb_t *rdb);
+uint32_t srtp_rdb_get_value(const srtp_rdb_t *rdb);
 
 
-#endif /* REPLAY_DB_H */ 
+#endif /* REPLAY_DB_H */
diff --git a/crypto/include/rdbx.h b/crypto/include/rdbx.h
index e9e99d5..b1c61da 100644
--- a/crypto/include/rdbx.h
+++ b/crypto/include/rdbx.h
@@ -14,154 +14,136 @@
 #include "datatypes.h"
 #include "err.h"
 
-/* #define ROC_TEST */  
+/* #define ROC_TEST */
 
 #ifndef ROC_TEST
 
-typedef uint16_t sequence_number_t;   /* 16 bit sequence number  */
-typedef uint32_t rollover_counter_t;   /* 32 bit rollover counter */
+typedef uint16_t srtp_sequence_number_t;   /* 16 bit sequence number  */
+typedef uint32_t srtp_rollover_counter_t;  /* 32 bit rollover counter */
 
 #else  /* use small seq_num and roc datatypes for testing purposes */
 
-typedef unsigned char sequence_number_t;         /* 8 bit sequence number   */
-typedef uint16_t rollover_counter_t;   /* 16 bit rollover counter */
+typedef unsigned char srtp_sequence_number_t; /* 8 bit sequence number   */
+typedef uint16_t srtp_rollover_counter_t;     /* 16 bit rollover counter */
 
 #endif
 
-#define seq_num_median (1 << (8*sizeof(sequence_number_t) - 1))
-#define seq_num_max    (1 << (8*sizeof(sequence_number_t)))
+#define seq_num_median (1 << (8 * sizeof(srtp_sequence_number_t) - 1))
+#define seq_num_max    (1 << (8 * sizeof(srtp_sequence_number_t)))
 
 /*
- * An xtd_seq_num_t is a 64-bit unsigned integer used as an 'extended'
- * sequence number.  
+ * An rtp_xtd_seq_num_t is a 64-bit unsigned integer used as an 'extended'
+ * sequence number.
  */
-
-typedef uint64_t xtd_seq_num_t;
+typedef uint64_t srtp_xtd_seq_num_t;
 
 
 /*
- * An rdbx_t is a replay database with extended range; it uses an
+ * An srtp_rdbx_t is a replay database with extended range; it uses an
  * xtd_seq_num_t and a bitmask of recently received indices.
  */
-
 typedef struct {
-  xtd_seq_num_t index;
-  bitvector_t bitmask;
-} rdbx_t;
+    srtp_xtd_seq_num_t index;
+    bitvector_t bitmask;
+} srtp_rdbx_t;
 
 
 /*
- * rdbx_init(rdbx_ptr, ws)
+ * srtp_rdbx_init(rdbx_ptr, ws)
  *
  * initializes the rdbx pointed to by its argument with the window size ws,
  * setting the rollover counter and sequence number to zero
  */
-srtp_err_status_t rdbx_init(rdbx_t *rdbx, unsigned long ws);
+srtp_err_status_t srtp_rdbx_init(srtp_rdbx_t *rdbx, unsigned long ws);
 
 
 /*
- * rdbx_dealloc(rdbx_ptr)
+ * srtp_rdbx_dealloc(rdbx_ptr)
  *
  * frees memory associated with the rdbx
  */
-srtp_err_status_t rdbx_dealloc(rdbx_t *rdbx);
+srtp_err_status_t srtp_rdbx_dealloc(srtp_rdbx_t *rdbx);
 
 
 /*
- * rdbx_estimate_index(rdbx, guess, s)
- * 
+ * srtp_rdbx_estimate_index(rdbx, guess, s)
+ *
  * given an rdbx and a sequence number s (from a newly arrived packet),
  * sets the contents of *guess to contain the best guess of the packet
  * index to which s corresponds, and returns the difference between
  * *guess and the locally stored synch info
  */
-
-int
-rdbx_estimate_index(const rdbx_t *rdbx,
-		    xtd_seq_num_t *guess,
-		    sequence_number_t s);
+int srtp_rdbx_estimate_index(const srtp_rdbx_t *rdbx, srtp_xtd_seq_num_t *guess, srtp_sequence_number_t s);
 
 /*
- * rdbx_check(rdbx, delta);
+ * srtp_rdbx_check(rdbx, delta);
  *
- * rdbx_check(&r, delta) checks to see if the xtd_seq_num_t
+ * srtp_rdbx_check(&r, delta) checks to see if the xtd_seq_num_t
  * which is at rdbx->window_start + delta is in the rdb
  *
  */
-srtp_err_status_t rdbx_check(const rdbx_t *rdbx, int difference);
+srtp_err_status_t srtp_rdbx_check(const srtp_rdbx_t *rdbx, int difference);
 
 /*
- * replay_add_index(rdbx, delta)
- * 
- * adds the xtd_seq_num_t at rdbx->window_start + delta to replay_db
+ * srtp_replay_add_index(rdbx, delta)
+ *
+ * adds the srtp_xtd_seq_num_t at rdbx->window_start + delta to replay_db
  * (and does *not* check if that xtd_seq_num_t appears in db)
  *
  * this function should be called *only* after replay_check has
  * indicated that the index does not appear in the rdbx, and a mutex
  * should protect the rdbx between these calls if necessary.
  */
-srtp_err_status_t rdbx_add_index(rdbx_t *rdbx, int delta);
+srtp_err_status_t srtp_rdbx_add_index(srtp_rdbx_t *rdbx, int delta);
 
 
 /*
- * rdbx_set_roc(rdbx, roc) initalizes the rdbx_t at the location rdbx
+ * srtp_rdbx_set_roc(rdbx, roc) initalizes the srtp_rdbx_t at the location rdbx
  * to have the rollover counter value roc.  If that value is less than
  * the current rollover counter value, then the function returns
  * srtp_err_status_replay_old; otherwise, srtp_err_status_ok is returned.
- * 
+ *
  */
-srtp_err_status_t rdbx_set_roc(rdbx_t *rdbx, uint32_t roc);
+srtp_err_status_t srtp_rdbx_set_roc(srtp_rdbx_t *rdbx, uint32_t roc);
 
 /*
- * rdbx_get_roc(rdbx) returns the value of the rollover counter for
- * the rdbx_t pointed to by rdbx
- * 
+ * srtp_rdbx_get_roc(rdbx) returns the value of the rollover counter for
+ * the srtp_rdbx_t pointed to by rdbx
+ *
  */
-
-xtd_seq_num_t
-rdbx_get_packet_index(const rdbx_t *rdbx);
+srtp_xtd_seq_num_t srtp_rdbx_get_packet_index(const srtp_rdbx_t *rdbx);
 
 /*
- * xtd_seq_num_t functions - these are *internal* functions of rdbx, and
+ * srtp_xtd_seq_num_t functions - these are *internal* functions of rdbx, and
  * shouldn't be used to manipulate rdbx internal values.  use the rdbx
  * api instead!
  */
 
 /*
- * rdbx_get_ws(rdbx_ptr)
+ * srtp_rdbx_get_ws(rdbx_ptr)
  *
  * gets the window size which was used to initialize the rdbx
  */
-
-unsigned long
-rdbx_get_window_size(const rdbx_t *rdbx);
+unsigned long srtp_rdbx_get_window_size(const srtp_rdbx_t *rdbx);
 
 
 /* index_init(&pi) initializes a packet index pi (sets it to zero) */
-
-void
-index_init(xtd_seq_num_t *pi);
+void srtp_index_init(srtp_xtd_seq_num_t *pi);
 
 /* index_advance(&pi, s) advances a xtd_seq_num_t forward by s */
-
-void
-index_advance(xtd_seq_num_t *pi, sequence_number_t s);
+void srtp_index_advance(srtp_xtd_seq_num_t *pi, srtp_sequence_number_t s);
 
 
 /*
- * index_guess(local, guess, s)
- * 
- * given a xtd_seq_num_t local (which represents the highest
+ * srtp_index_guess(local, guess, s)
+ *
+ * given a srtp_xtd_seq_num_t local (which represents the highest
  * known-to-be-good index) and a sequence number s (from a newly
  * arrived packet), sets the contents of *guess to contain the best
  * guess of the packet index to which s corresponds, and returns the
  * difference between *guess and *local
  */
-
-int
-index_guess(const xtd_seq_num_t *local,
-		   xtd_seq_num_t *guess,
-		   sequence_number_t s);
+int srtp_index_guess(const srtp_xtd_seq_num_t *local, srtp_xtd_seq_num_t *guess, srtp_sequence_number_t s);
 
 
 #endif /* RDBX_H */
diff --git a/crypto/kernel/key.c b/crypto/kernel/key.c
index ef6201a..2895a6d 100644
--- a/crypto/kernel/key.c
+++ b/crypto/kernel/key.c
@@ -50,7 +50,7 @@
 
 #define soft_limit 0x10000
 
-srtp_err_status_t srtp_key_limit_set (srtp_key_limit_t key, const xtd_seq_num_t s)
+srtp_err_status_t srtp_key_limit_set (srtp_key_limit_t key, const srtp_xtd_seq_num_t s)
 {
 #ifdef NO_64BIT_MATH
     if (high32(s) == 0 && low32(s) < soft_limit) {
diff --git a/crypto/replay/rdb.c b/crypto/replay/rdb.c
index cb35b8a..fbbbdb2 100644
--- a/crypto/replay/rdb.c
+++ b/crypto/replay/rdb.c
@@ -8,26 +8,26 @@
  */
 
 /*
- *	
+ *
  * Copyright (c) 2001-2006, Cisco Systems, Inc.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  *   Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
- * 
+ *
  *   Redistributions in binary form must reproduce the above
  *   copyright notice, this list of conditions and the following
  *   disclaimer in the documentation and/or other materials provided
  *   with the distribution.
- * 
+ *
  *   Neither the name of the Cisco Systems, Inc. nor the names of its
  *   contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -53,89 +53,90 @@
 
 /*
  * this implementation of a replay database works as follows:
- * 
+ *
  * window_start is the index of the first packet in the window
  * bitmask      a bit-buffer, containing the most recently entered
- *              index as the leftmost bit 
+ *              index as the leftmost bit
  *
  */
 
-/* rdb_init initalizes rdb */
-
-srtp_err_status_t
-rdb_init(rdb_t *rdb) {
-  v128_set_to_zero(&rdb->bitmask);
-  rdb->window_start = 0;
-  return srtp_err_status_ok;
-}
-
-/*
- * rdb_check checks to see if index appears in rdb
- */
-
-srtp_err_status_t
-rdb_check(const rdb_t *rdb, uint32_t p_index) {
-  
-  /* if the index appears after (or at very end of) the window, its good */
-  if (p_index >= rdb->window_start + rdb_bits_in_bitmask)
+/* srtp_rdb_init initalizes rdb */
+srtp_err_status_t srtp_rdb_init (srtp_rdb_t *rdb)
+{
+    v128_set_to_zero(&rdb->bitmask);
+    rdb->window_start = 0;
     return srtp_err_status_ok;
-  
-  /* if the index appears before the window, its bad */
-  if (p_index < rdb->window_start)
-    return srtp_err_status_replay_old;
-
-  /* otherwise, the index appears within the window, so check the bitmask */
-  if (v128_get_bit(&rdb->bitmask, (p_index - rdb->window_start)) == 1)
-    return srtp_err_status_replay_fail;    
-      
-  /* otherwise, the index is okay */
-  return srtp_err_status_ok;
 }
 
 /*
- * rdb_add_index adds index to rdb_t (and does *not* check if
+ * srtp_rdb_check checks to see if index appears in rdb
+ */
+srtp_err_status_t srtp_rdb_check (const srtp_rdb_t *rdb, uint32_t p_index)
+{
+
+    /* if the index appears after (or at very end of) the window, its good */
+    if (p_index >= rdb->window_start + rdb_bits_in_bitmask) {
+        return srtp_err_status_ok;
+    }
+
+    /* if the index appears before the window, its bad */
+    if (p_index < rdb->window_start) {
+        return srtp_err_status_replay_old;
+    }
+
+    /* otherwise, the index appears within the window, so check the bitmask */
+    if (v128_get_bit(&rdb->bitmask, (p_index - rdb->window_start)) == 1) {
+        return srtp_err_status_replay_fail;
+    }
+
+    /* otherwise, the index is okay */
+    return srtp_err_status_ok;
+}
+
+/*
+ * srtp_rdb_add_index adds index to srtp_rdb_t (and does *not* check if
  * index appears in db)
  *
- * this function should be called only after rdb_check has
+ * this function should be called only after srtp_rdb_check has
  * indicated that the index does not appear in the rdb, e.g., a mutex
  * should protect the rdb between these calls
  */
+srtp_err_status_t srtp_rdb_add_index (srtp_rdb_t *rdb, uint32_t p_index)
+{
+    int delta;
 
-srtp_err_status_t
-rdb_add_index(rdb_t *rdb, uint32_t p_index) {
-  int delta;  
+    /* here we *assume* that p_index > rdb->window_start */
 
-  /* here we *assume* that p_index > rdb->window_start */
+    delta = (p_index - rdb->window_start);
+    if (delta < rdb_bits_in_bitmask) {
 
-  delta = (p_index - rdb->window_start);    
-  if (delta < rdb_bits_in_bitmask) {
+        /* if the p_index is within the window, set the appropriate bit */
+        v128_set_bit(&rdb->bitmask, delta);
 
-    /* if the p_index is within the window, set the appropriate bit */
-    v128_set_bit(&rdb->bitmask, delta);
+    } else {
 
-  } else { 
-    
-    delta -= rdb_bits_in_bitmask - 1;
+        delta -= rdb_bits_in_bitmask - 1;
 
-    /* shift the window forward by delta bits*/
-    v128_left_shift(&rdb->bitmask, delta);
-    v128_set_bit(&rdb->bitmask, rdb_bits_in_bitmask-1);
-    rdb->window_start += delta;
+        /* shift the window forward by delta bits*/
+        v128_left_shift(&rdb->bitmask, delta);
+        v128_set_bit(&rdb->bitmask, rdb_bits_in_bitmask - 1);
+        rdb->window_start += delta;
 
-  }    
+    }
 
-  return srtp_err_status_ok;
+    return srtp_err_status_ok;
 }
 
-srtp_err_status_t
-rdb_increment(rdb_t *rdb) {
+srtp_err_status_t srtp_rdb_increment (srtp_rdb_t *rdb)
+{
 
-  if (rdb->window_start++ > 0x7fffffff)
-    return srtp_err_status_key_expired;
-  return srtp_err_status_ok;
+    if (rdb->window_start++ > 0x7fffffff) {
+        return srtp_err_status_key_expired;
+    }
+    return srtp_err_status_ok;
 }
 
-uint32_t
-rdb_get_value(const rdb_t *rdb) {
-  return rdb->window_start;
+uint32_t srtp_rdb_get_value (const srtp_rdb_t *rdb)
+{
+    return rdb->window_start;
 }
diff --git a/crypto/replay/rdbx.c b/crypto/replay/rdbx.c
index fce8f0a..e1279df 100644
--- a/crypto/replay/rdbx.c
+++ b/crypto/replay/rdbx.c
@@ -8,26 +8,26 @@
  */
 
 /*
- *	
+ *
  * Copyright (c) 2001-2006, Cisco Systems, Inc.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  *   Redistributions of source code must retain the above copyright
  *   notice, this list of conditions and the following disclaimer.
- * 
+ *
  *   Redistributions in binary form must reproduce the above
  *   copyright notice, this list of conditions and the following
  *   disclaimer in the documentation and/or other materials provided
  *   with the distribution.
- * 
+ *
  *   Neither the name of the Cisco Systems, Inc. nor the names of its
  *   contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -69,111 +69,109 @@
 /*
  * rdbx implementation notes
  *
- * A xtd_seq_num_t is essentially a sequence number for which some of
+ * A srtp_xtd_seq_num_t is essentially a sequence number for which some of
  * the data on the wire are implicit.  It logically consists of a
  * rollover counter and a sequence number; the sequence number is the
  * explicit part, and the rollover counter is the implicit part.
  *
  * Upon receiving a sequence_number (e.g. in a newly received SRTP
- * packet), the complete xtd_seq_num_t can be estimated by using a
- * local xtd_seq_num_t as a basis.  This is done using the function
- * index_guess(&local, &guess, seq_from_packet).  This function
+ * packet), the complete srtp_xtd_seq_num_t can be estimated by using a
+ * local srtp_xtd_seq_num_t as a basis.  This is done using the function
+ * srtp_index_guess(&local, &guess, seq_from_packet).  This function
  * returns the difference of the guess and the local value.  The local
- * xtd_seq_num_t can be moved forward to the guess using the function
- * index_advance(&guess, delta), where delta is the difference.
- * 
+ * srtp_xtd_seq_num_t can be moved forward to the guess using the function
+ * srtp_index_advance(&guess, delta), where delta is the difference.
  *
- * A rdbx_t consists of a xtd_seq_num_t and a bitmask.  The index is highest
+ *
+ * A srtp_rdbx_t consists of a srtp_xtd_seq_num_t and a bitmask.  The index is highest
  * sequence number that has been received, and the bitmask indicates
  * which of the recent indicies have been received as well.  The
  * highest bit in the bitmask corresponds to the index in the bitmask.
  */
 
 
-void
-index_init(xtd_seq_num_t *pi) {
+void srtp_index_init (srtp_xtd_seq_num_t *pi)
+{
 #ifdef NO_64BIT_MATH
-  *pi = make64(0,0);
+    *pi = make64(0, 0);
 #else
-  *pi = 0;
+    *pi = 0;
 #endif
 }
 
-void
-index_advance(xtd_seq_num_t *pi, sequence_number_t s) {
+void srtp_index_advance (srtp_xtd_seq_num_t *pi, srtp_sequence_number_t s)
+{
 #ifdef NO_64BIT_MATH
-  /* a > ~b means a+b will generate a carry */
-  /* s is uint16 here */
-  *pi = make64(high32(*pi) + (s > ~low32(*pi) ? 1 : 0),low32(*pi) + s);
+    /* a > ~b means a+b will generate a carry */
+    /* s is uint16 here */
+    *pi = make64(high32(*pi) + (s > ~low32(*pi) ? 1 : 0), low32(*pi) + s);
 #else
-  *pi += s;
+    *pi += s;
 #endif
 }
 
 
 /*
- * index_guess(local, guess, s)
- * 
- * given a xtd_seq_num_t local (which represents the last
- * known-to-be-good received xtd_seq_num_t) and a sequence number s
+ * srtp_index_guess(local, guess, s)
+ *
+ * given a srtp_xtd_seq_num_t local (which represents the last
+ * known-to-be-good received srtp_xtd_seq_num_t) and a sequence number s
  * (from a newly arrived packet), sets the contents of *guess to
  * contain the best guess of the packet index to which s corresponds,
  * and returns the difference between *guess and *local
  *
  * nota bene - the output is a signed integer, DON'T cast it to a
- * unsigned integer!  
+ * unsigned integer!
  */
 
-int
-index_guess(const xtd_seq_num_t *local,
-		   xtd_seq_num_t *guess,
-		   sequence_number_t s) {
+int srtp_index_guess (const srtp_xtd_seq_num_t *local, srtp_xtd_seq_num_t *guess, srtp_sequence_number_t s)
+{
 #ifdef NO_64BIT_MATH
-  uint32_t local_roc = ((high32(*local) << 16) |
-						(low32(*local) >> 16));
-  uint16_t local_seq = (uint16_t) (low32(*local));
+    uint32_t local_roc = ((high32(*local) << 16) |
+                          (low32(*local) >> 16));
+    uint16_t local_seq = (uint16_t)(low32(*local));
 #else
-  uint32_t local_roc = (uint32_t)(*local >> 16);
-  uint16_t local_seq = (uint16_t) *local;
+    uint32_t local_roc = (uint32_t)(*local >> 16);
+    uint16_t local_seq = (uint16_t)*local;
 #endif
 #ifdef NO_64BIT_MATH
-  uint32_t guess_roc = ((high32(*guess) << 16) |
-						(low32(*guess) >> 16));
-  uint16_t guess_seq = (uint16_t) (low32(*guess));
+    uint32_t guess_roc = ((high32(*guess) << 16) |
+                          (low32(*guess) >> 16));
+    uint16_t guess_seq = (uint16_t)(low32(*guess));
 #else
-  uint32_t guess_roc = (uint32_t)(*guess >> 16);
-  uint16_t guess_seq = (uint16_t) *guess;  
+    uint32_t guess_roc = (uint32_t)(*guess >> 16);
+    uint16_t guess_seq = (uint16_t)*guess;
 #endif
-  int difference;
-  
-  if (local_seq < seq_num_median) {
-    if (s - local_seq > seq_num_median) {
-      guess_roc = local_roc - 1;
-      difference = s - local_seq - seq_num_max;
+    int difference;
+
+    if (local_seq < seq_num_median) {
+        if (s - local_seq > seq_num_median) {
+            guess_roc = local_roc - 1;
+            difference = s - local_seq - seq_num_max;
+        } else {
+            guess_roc = local_roc;
+            difference = s - local_seq;
+        }
     } else {
-      guess_roc = local_roc;
-      difference = s - local_seq;
+        if (local_seq - seq_num_median > s) {
+            guess_roc = local_roc + 1;
+            difference = s - local_seq + seq_num_max;
+        } else {
+            guess_roc = local_roc;
+            difference = s - local_seq;
+        }
     }
-  } else {
-    if (local_seq - seq_num_median > s) {
-      guess_roc = local_roc + 1;
-      difference = s - local_seq + seq_num_max;
-    } else {
-      guess_roc = local_roc;
-      difference = s - local_seq;
-    }
-  }
-  guess_seq = s;
-  
-  /* Note: guess_roc is 32 bits, so this generates a 48-bit result! */
+    guess_seq = s;
+
+    /* Note: guess_roc is 32 bits, so this generates a 48-bit result! */
 #ifdef NO_64BIT_MATH
-  *guess = make64(guess_roc >> 16,
-				  (guess_roc << 16) | guess_seq);
+    *guess = make64(guess_roc >> 16,
+                    (guess_roc << 16) | guess_seq);
 #else
-  *guess = (((uint64_t) guess_roc) << 16) | guess_seq;
+    *guess = (((uint64_t)guess_roc) << 16) | guess_seq;
 #endif
 
-  return difference;
+    return difference;
 }
 
 /*
@@ -183,174 +181,167 @@
 
 
 /*
- *  rdbx_init(&r, ws) initializes the rdbx_t pointed to by r with window size ws
+ *  srtp_rdbx_init(&r, ws) initializes the srtp_rdbx_t pointed to by r with window size ws
  */
+srtp_err_status_t srtp_rdbx_init (srtp_rdbx_t *rdbx, unsigned long ws)
+{
+    if (ws == 0) {
+        return srtp_err_status_bad_param;
+    }
 
-srtp_err_status_t
-rdbx_init(rdbx_t *rdbx, unsigned long ws) {
-  if (ws == 0)
-    return srtp_err_status_bad_param;
+    if (bitvector_alloc(&rdbx->bitmask, ws) != 0) {
+        return srtp_err_status_alloc_fail;
+    }
 
-  if (bitvector_alloc(&rdbx->bitmask, ws) != 0)
-    return srtp_err_status_alloc_fail;
+    srtp_index_init(&rdbx->index);
 
-  index_init(&rdbx->index);
-
-  return srtp_err_status_ok;
+    return srtp_err_status_ok;
 }
 
 /*
- *  rdbx_dealloc(&r) frees memory for the rdbx_t pointed to by r
+ *  srtp_rdbx_dealloc(&r) frees memory for the srtp_rdbx_t pointed to by r
  */
+srtp_err_status_t srtp_rdbx_dealloc (srtp_rdbx_t *rdbx)
+{
+    bitvector_dealloc(&rdbx->bitmask);
 
-srtp_err_status_t
-rdbx_dealloc(rdbx_t *rdbx) {
-  bitvector_dealloc(&rdbx->bitmask);
-
-  return srtp_err_status_ok;
+    return srtp_err_status_ok;
 }
 
 /*
- * rdbx_set_roc(rdbx, roc) initalizes the rdbx_t at the location rdbx
+ * srtp_rdbx_set_roc(rdbx, roc) initalizes the srtp_rdbx_t at the location rdbx
  * to have the rollover counter value roc.  If that value is less than
  * the current rollover counter value, then the function returns
  * srtp_err_status_replay_old; otherwise, srtp_err_status_ok is returned.
- * 
+ *
  */
-
-srtp_err_status_t
-rdbx_set_roc(rdbx_t *rdbx, uint32_t roc) {
-  bitvector_set_to_zero(&rdbx->bitmask);
+srtp_err_status_t srtp_rdbx_set_roc (srtp_rdbx_t *rdbx, uint32_t roc)
+{
+    bitvector_set_to_zero(&rdbx->bitmask);
 
 #ifdef NO_64BIT_MATH
   #error not yet implemented
 #else
 
-  /* make sure that we're not moving backwards */
-  if (roc < (rdbx->index >> 16))
-    return srtp_err_status_replay_old;
+    /* make sure that we're not moving backwards */
+    if (roc < (rdbx->index >> 16)) {
+        return srtp_err_status_replay_old;
+    }
 
-  rdbx->index &= 0xffff;   /* retain lowest 16 bits */
-  rdbx->index |= ((uint64_t)roc) << 16;  /* set ROC */
+    rdbx->index &= 0xffff;                /* retain lowest 16 bits */
+    rdbx->index |= ((uint64_t)roc) << 16; /* set ROC */
 #endif
 
-  return srtp_err_status_ok;
+    return srtp_err_status_ok;
 }
 
 /*
- * rdbx_get_packet_index(rdbx) returns the value of the packet index
- * for the rdbx_t pointed to by rdbx
- * 
+ * srtp_rdbx_get_packet_index(rdbx) returns the value of the packet index
+ * for the srtp_rdbx_t pointed to by rdbx
+ *
  */
-
-xtd_seq_num_t
-rdbx_get_packet_index(const rdbx_t *rdbx) {
-  return rdbx->index;   
+srtp_xtd_seq_num_t srtp_rdbx_get_packet_index (const srtp_rdbx_t *rdbx)
+{
+    return rdbx->index;
 }
 
 /*
- * rdbx_get_window_size(rdbx) returns the value of the window size
- * for the rdbx_t pointed to by rdbx
- * 
+ * srtp_rdbx_get_window_size(rdbx) returns the value of the window size
+ * for the srtp_rdbx_t pointed to by rdbx
+ *
  */
-
-unsigned long
-rdbx_get_window_size(const rdbx_t *rdbx) {
-  return bitvector_get_length(&rdbx->bitmask);
+unsigned long srtp_rdbx_get_window_size (const srtp_rdbx_t *rdbx)
+{
+    return bitvector_get_length(&rdbx->bitmask);
 }
 
 /*
- * rdbx_check(&r, delta) checks to see if the xtd_seq_num_t
+ * srtp_rdbx_check(&r, delta) checks to see if the srtp_xtd_seq_num_t
  * which is at rdbx->index + delta is in the rdb
  */
+srtp_err_status_t srtp_rdbx_check (const srtp_rdbx_t *rdbx, int delta)
+{
 
-srtp_err_status_t
-rdbx_check(const rdbx_t *rdbx, int delta) {
-  
-  if (delta > 0) {       /* if delta is positive, it's good */
+    if (delta > 0) {     /* if delta is positive, it's good */
+        return srtp_err_status_ok;
+    } else if ((int)(bitvector_get_length(&rdbx->bitmask) - 1) + delta < 0) {
+        /* if delta is lower than the bitmask, it's bad */
+        return srtp_err_status_replay_old;
+    } else if (bitvector_get_bit(&rdbx->bitmask,
+                                 (int)(bitvector_get_length(&rdbx->bitmask) - 1) + delta) == 1) {
+        /* delta is within the window, so check the bitmask */
+        return srtp_err_status_replay_fail;
+    }
+    /* otherwise, the index is okay */
+
     return srtp_err_status_ok;
-  } else if ((int)(bitvector_get_length(&rdbx->bitmask) - 1) + delta < 0) {   
-                         /* if delta is lower than the bitmask, it's bad */
-    return srtp_err_status_replay_old; 
-  } else if (bitvector_get_bit(&rdbx->bitmask, 
-			       (int)(bitvector_get_length(&rdbx->bitmask) - 1) + delta) == 1) {
-                         /* delta is within the window, so check the bitmask */
-    return srtp_err_status_replay_fail;    
-  }
- /* otherwise, the index is okay */
-
-  return srtp_err_status_ok; 
 }
 
 /*
- * rdbx_add_index adds the xtd_seq_num_t at rdbx->window_start + d to
- * replay_db (and does *not* check if that xtd_seq_num_t appears in db)
+ * srtp_rdbx_add_index adds the srtp_xtd_seq_num_t at rdbx->window_start + d to
+ * replay_db (and does *not* check if that srtp_xtd_seq_num_t appears in db)
  *
  * this function should be called only after replay_check has
  * indicated that the index does not appear in the rdbx, e.g., a mutex
  * should protect the rdbx between these calls if need be
  */
+srtp_err_status_t srtp_rdbx_add_index (srtp_rdbx_t *rdbx, int delta)
+{
 
-srtp_err_status_t
-rdbx_add_index(rdbx_t *rdbx, int delta) {
-  
-  if (delta > 0) {
-    /* shift forward by delta */
-    index_advance(&rdbx->index, delta);
-    bitvector_left_shift(&rdbx->bitmask, delta);
-    bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1);
-  } else {
-    /* delta is in window */
-    bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) -1 + delta);
-  }
+    if (delta > 0) {
+        /* shift forward by delta */
+        srtp_index_advance(&rdbx->index, delta);
+        bitvector_left_shift(&rdbx->bitmask, delta);
+        bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1);
+    } else {
+        /* delta is in window */
+        bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1 + delta);
+    }
 
-  /* note that we need not consider the case that delta == 0 */
-  
-  return srtp_err_status_ok;
+    /* note that we need not consider the case that delta == 0 */
+
+    return srtp_err_status_ok;
 }
 
 
 
 /*
- * rdbx_estimate_index(rdbx, guess, s)
- * 
+ * srtp_rdbx_estimate_index(rdbx, guess, s)
+ *
  * given an rdbx and a sequence number s (from a newly arrived packet),
  * sets the contents of *guess to contain the best guess of the packet
  * index to which s corresponds, and returns the difference between
  * *guess and the locally stored synch info
  */
+int srtp_rdbx_estimate_index (const srtp_rdbx_t *rdbx, srtp_xtd_seq_num_t *guess, srtp_sequence_number_t s)
+{
 
-int
-rdbx_estimate_index(const rdbx_t *rdbx,
-		    xtd_seq_num_t *guess,
-		    sequence_number_t s) {
-
-  /*
-   * if the sequence number and rollover counter in the rdbx are
-   * non-zero, then use the index_guess(...) function, otherwise, just
-   * set the rollover counter to zero (since the index_guess(...)
-   * function might incorrectly guess that the rollover counter is
-   * 0xffffffff)
-   */
+    /*
+     * if the sequence number and rollover counter in the rdbx are
+     * non-zero, then use the srtp_index_guess(...) function, otherwise, just
+     * set the rollover counter to zero (since the srtp_index_guess(...)
+     * function might incorrectly guess that the rollover counter is
+     * 0xffffffff)
+     */
 
 #ifdef NO_64BIT_MATH
-  /* seq_num_median = 0x8000 */
-  if (high32(rdbx->index) > 0 ||
-	  low32(rdbx->index) > seq_num_median)
+    /* seq_num_median = 0x8000 */
+    if (high32(rdbx->index) > 0 ||
+        low32(rdbx->index) > seq_num_median)
 #else
-  if (rdbx->index > seq_num_median)
+    if (rdbx->index > seq_num_median)
 #endif
-    return index_guess(&rdbx->index, guess, s);
-  
+    { return srtp_index_guess(&rdbx->index, guess, s); }
+
 #ifdef NO_64BIT_MATH
-  *guess = make64(0,(uint32_t) s);
-#else  
-  *guess = s;
+    *guess = make64(0, (uint32_t)s);
+#else
+    *guess = s;
 #endif
 
 #ifdef NO_64BIT_MATH
-  return s - (uint16_t) low32(rdbx->index);
+    return s - (uint16_t)low32(rdbx->index);
 #else
-  return s - (uint16_t) rdbx->index;
+    return s - (uint16_t)rdbx->index;
 #endif
 }
diff --git a/include/ekt.h b/include/ekt.h
index e07d264..9d7d6b2 100644
--- a/include/ekt.h
+++ b/include/ekt.h
@@ -133,7 +133,7 @@
 srtp_err_status_t srtp_stream_init_from_ekt(srtp_stream_t stream, const void *srtcp_hdr, unsigned pkt_octet_len);
 		
 
-void srtp_ekt_write_data(srtp_ekt_stream_t ekt, uint8_t *base_tag, unsigned base_tag_len, int *packet_len, xtd_seq_num_t pkt_index);		
+void srtp_ekt_write_data(srtp_ekt_stream_t ekt, uint8_t *base_tag, unsigned base_tag_len, int *packet_len, srtp_xtd_seq_num_t pkt_index);		
 
 /*
  * We handle EKT by performing some additional steps before
diff --git a/include/srtp_priv.h b/include/srtp_priv.h
index b5aaf3e..4debc51 100644
--- a/include/srtp_priv.h
+++ b/include/srtp_priv.h
@@ -105,11 +105,11 @@
   uint32_t   ssrc;
   srtp_cipher_t  *rtp_cipher;
   srtp_auth_t    *rtp_auth;
-  rdbx_t     rtp_rdbx;
+  srtp_rdbx_t     rtp_rdbx;
   srtp_sec_serv_t rtp_services;
   srtp_cipher_t  *rtcp_cipher;
   srtp_auth_t    *rtcp_auth;
-  rdb_t      rtcp_rdb;
+  srtp_rdb_t      rtcp_rdb;
   srtp_sec_serv_t rtcp_services;
   srtp_key_limit_ctx_t *limit;
   direction_t direction;
diff --git a/srtp/ekt.c b/srtp/ekt.c
index 0435094..340229b 100644
--- a/srtp/ekt.c
+++ b/srtp/ekt.c
@@ -179,7 +179,7 @@
 
   /* set the SRTP ROC */
   roc = srtcp_packet_get_ekt_roc(srtcp_hdr, pkt_octet_len);
-  err = rdbx_set_roc(&stream->rtp_rdbx, roc);
+  err = srtp_rdbx_set_roc(&stream->rtp_rdbx, roc);
   if (err) return err;
 
   err = srtp_stream_init(stream, &srtp_policy);
@@ -188,7 +188,7 @@
   return srtp_err_status_ok;
 }
 
-void srtp_ekt_write_data(srtp_ekt_stream_t ekt, uint8_t *base_tag, unsigned base_tag_len, int *packet_len, xtd_seq_num_t pkt_index) {
+void srtp_ekt_write_data(srtp_ekt_stream_t ekt, uint8_t *base_tag, unsigned base_tag_len, int *packet_len, srtp_xtd_seq_num_t pkt_index) {
   uint32_t roc;
   uint16_t isn;
   unsigned emk_len;
diff --git a/srtp/srtp.c b/srtp/srtp.c
index 9080bce..e9cdaa9 100644
--- a/srtp/srtp.c
+++ b/srtp/srtp.c
@@ -270,7 +270,7 @@
       return status;
   }
 
-  status = rdbx_dealloc(&stream->rtp_rdbx);
+  status = srtp_rdbx_dealloc(&stream->rtp_rdbx);
   if (status)
     return status;
 
@@ -328,14 +328,14 @@
   }
 
   /* initialize replay databases */
-  status = rdbx_init(&str->rtp_rdbx,
-		     rdbx_get_window_size(&stream_template->rtp_rdbx));
+  status = srtp_rdbx_init(&str->rtp_rdbx,
+		     srtp_rdbx_get_window_size(&stream_template->rtp_rdbx));
   if (status) {
     srtp_crypto_free(*str_ptr);
     *str_ptr = NULL;
     return status;
   }
-  rdb_init(&str->rtcp_rdb);
+  srtp_rdb_init(&str->rtcp_rdb);
   str->allow_repeat_tx = stream_template->allow_repeat_tx;
   
   /* set ssrc to that provided */
@@ -684,9 +684,9 @@
      return srtp_err_status_bad_param;
 
    if (p->window_size != 0)
-     err = rdbx_init(&srtp->rtp_rdbx, p->window_size);
+     err = srtp_rdbx_init(&srtp->rtp_rdbx, p->window_size);
    else
-     err = rdbx_init(&srtp->rtp_rdbx, 128);
+     err = srtp_rdbx_init(&srtp->rtp_rdbx, 128);
    if (err) return err;
 
    /* initialize key limit to maximum value */
@@ -715,12 +715,12 @@
    srtp->direction = dir_unknown;
 
    /* initialize SRTCP replay database */
-   rdb_init(&srtp->rtcp_rdb);
+   srtp_rdb_init(&srtp->rtcp_rdb);
 
    /* initialize allow_repeat_tx */
    /* guard against uninitialized memory: allow only 0 or 1 here */
    if (p->allow_repeat_tx != 0 && p->allow_repeat_tx != 1) {
-     rdbx_dealloc(&srtp->rtp_rdbx);
+     srtp_rdbx_dealloc(&srtp->rtp_rdbx);
      return srtp_err_status_bad_param;
    }
    srtp->allow_repeat_tx = p->allow_repeat_tx;
@@ -730,7 +730,7 @@
    /* initialize keys */
    err = srtp_stream_init_keys(srtp, p->key);
    if (err) {
-     rdbx_dealloc(&srtp->rtp_rdbx);
+     srtp_rdbx_dealloc(&srtp->rtp_rdbx);
      return err;
    }
 
@@ -740,7 +740,7 @@
     */
    err = srtp_ekt_stream_init_from_policy(srtp->ekt, p->ekt);
    if (err) {
-     rdbx_dealloc(&srtp->rtp_rdbx);
+     srtp_rdbx_dealloc(&srtp->rtp_rdbx);
      return err;
    }
 
@@ -832,7 +832,7 @@
  *
  */
 static void srtp_calc_aead_iv(srtp_stream_ctx_t *stream, v128_t *iv, 
-	                      xtd_seq_num_t *seq, srtp_hdr_t *hdr)
+	                      srtp_xtd_seq_num_t *seq, srtp_hdr_t *hdr)
 {
     v128_t	in;
     v128_t	salt;
@@ -884,7 +884,7 @@
     srtp_hdr_t *hdr = (srtp_hdr_t*)rtp_hdr;
     uint32_t *enc_start;        /* pointer to start of encrypted portion  */
     unsigned int enc_octet_len = 0; /* number of octets in encrypted portion  */
-    xtd_seq_num_t est;          /* estimated xtd_seq_num_t of *hdr        */
+    srtp_xtd_seq_num_t est;          /* estimated xtd_seq_num_t of *hdr        */
     int delta;                  /* delta of local pkt idx and that in hdr */
     srtp_err_status_t status;
     int tag_len;
@@ -933,14 +933,14 @@
      * estimate the packet index using the start of the replay window
      * and the sequence number from the header
      */
-    delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
-    status = rdbx_check(&stream->rtp_rdbx, delta);
+    delta = srtp_rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+    status = srtp_rdbx_check(&stream->rtp_rdbx, delta);
     if (status) {
 	if (status != srtp_err_status_replay_fail || !stream->allow_repeat_tx) {
 	    return status;  /* we've been asked to reuse an index */
 	}
     } else {
-	rdbx_add_index(&stream->rtp_rdbx, delta);
+	srtp_rdbx_add_index(&stream->rtp_rdbx, delta);
     }
 
 #ifdef NO_64BIT_MATH
@@ -1010,7 +1010,7 @@
  */
 static srtp_err_status_t
 srtp_unprotect_aead (srtp_ctx_t *ctx, srtp_stream_ctx_t *stream, int delta, 
-	             xtd_seq_num_t est, void *srtp_hdr, unsigned int *pkt_octet_len)
+	             srtp_xtd_seq_num_t est, void *srtp_hdr, unsigned int *pkt_octet_len)
 {
     srtp_hdr_t *hdr = (srtp_hdr_t*)srtp_hdr;
     uint32_t *enc_start;        /* pointer to start of encrypted portion  */
@@ -1153,7 +1153,7 @@
      * the message authentication function passed, so add the packet
      * index into the replay database
      */
-    rdbx_add_index(&stream->rtp_rdbx, delta);
+    srtp_rdbx_add_index(&stream->rtp_rdbx, delta);
 
     /* decrease the packet length by the length of the auth tag */
     *pkt_octet_len -= tag_len;
@@ -1170,7 +1170,7 @@
    uint32_t *enc_start;        /* pointer to start of encrypted portion  */
    uint32_t *auth_start;       /* pointer to start of auth. portion      */
    unsigned int enc_octet_len = 0; /* number of octets in encrypted portion  */
-   xtd_seq_num_t est;          /* estimated xtd_seq_num_t of *hdr        */
+   srtp_xtd_seq_num_t est;          /* estimated xtd_seq_num_t of *hdr        */
    int delta;                  /* delta of local pkt idx and that in hdr */
    uint8_t *auth_tag = NULL;   /* location of auth_tag within packet     */
    srtp_err_status_t status;   
@@ -1302,14 +1302,14 @@
     * estimate the packet index using the start of the replay window   
     * and the sequence number from the header
     */
-   delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
-   status = rdbx_check(&stream->rtp_rdbx, delta);
+   delta = srtp_rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+   status = srtp_rdbx_check(&stream->rtp_rdbx, delta);
    if (status) {
      if (status != srtp_err_status_replay_fail || !stream->allow_repeat_tx)
        return status;  /* we've been asked to reuse an index */
    }
    else
-     rdbx_add_index(&stream->rtp_rdbx, delta);
+     srtp_rdbx_add_index(&stream->rtp_rdbx, delta);
 
 #ifdef NO_64BIT_MATH
    debug_print2(mod_srtp, "estimated packet index: %08x%08x", 
@@ -1426,7 +1426,7 @@
   uint32_t *auth_start;     /* pointer to start of auth. portion      */
   unsigned int enc_octet_len = 0;/* number of octets in encrypted portion */
   uint8_t *auth_tag = NULL; /* location of auth_tag within packet     */
-  xtd_seq_num_t est;        /* estimated xtd_seq_num_t of *hdr        */
+  srtp_xtd_seq_num_t est;        /* estimated xtd_seq_num_t of *hdr        */
   int delta;                /* delta of local pkt idx and that in hdr */
   v128_t iv;
   srtp_err_status_t status;
@@ -1461,10 +1461,10 @@
        * and set delta equal to the same value
        */
 #ifdef NO_64BIT_MATH
-      est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq));
+      est = (srtp_xtd_seq_num_t) make64(0,ntohs(hdr->seq));
       delta = low32(est);
 #else
-      est = (xtd_seq_num_t) ntohs(hdr->seq);
+      est = (srtp_xtd_seq_num_t) ntohs(hdr->seq);
       delta = (int)est;
 #endif
     } else {
@@ -1478,10 +1478,10 @@
   } else {
   
     /* estimate packet index from seq. num. in header */
-    delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+    delta = srtp_rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
     
     /* check replay database */
-    status = rdbx_check(&stream->rtp_rdbx, delta);
+    status = srtp_rdbx_check(&stream->rtp_rdbx, delta);
     if (status)
       return status;
   }
@@ -1700,7 +1700,7 @@
    * the message authentication function passed, so add the packet
    * index into the replay database 
    */
-  rdbx_add_index(&stream->rtp_rdbx, delta);
+  srtp_rdbx_add_index(&stream->rtp_rdbx, delta);
 
   /* decrease the packet length by the length of the auth tag */
   *pkt_octet_len -= tag_len;
@@ -1818,7 +1818,7 @@
     status = auth_dealloc(session->stream_template->rtp_auth);
     if (status)
       return status;
-    status = rdbx_dealloc(&session->stream_template->rtp_rdbx);
+    status = srtp_rdbx_dealloc(&session->stream_template->rtp_rdbx);
     if (status)
       return status;
     srtp_crypto_free(session->stream_template);
@@ -2315,11 +2315,11 @@
      * check sequence number for overruns, and copy it into the packet
      * if its value isn't too big
      */
-    status = rdb_increment(&stream->rtcp_rdb);
+    status = srtp_rdb_increment(&stream->rtcp_rdb);
     if (status) {
         return status;
     }
-    seq_num = rdb_get_value(&stream->rtcp_rdb);
+    seq_num = srtp_rdb_get_value(&stream->rtcp_rdb);
     *trailer |= htonl(seq_num);
     debug_print(mod_srtp, "srtcp index: %x", seq_num);
 
@@ -2468,7 +2468,7 @@
     /* this is easier than dealing with bitfield access */
     seq_num = ntohl(*trailer) & SRTCP_INDEX_MASK;
     debug_print(mod_srtp, "srtcp index: %x", seq_num);
-    status = rdb_check(&stream->rtcp_rdb, seq_num);
+    status = srtp_rdb_check(&stream->rtcp_rdb, seq_num);
     if (status) {
         return status;
     }
@@ -2587,7 +2587,7 @@
     }
 
     /* we've passed the authentication check, so add seq_num to the rdb */
-    rdb_add_index(&stream->rtcp_rdb, seq_num);
+    srtp_rdb_add_index(&stream->rtcp_rdb, seq_num);
 
     return srtp_err_status_ok;
 }
@@ -2701,16 +2701,16 @@
 
   /* perform EKT processing if needed */
   srtp_ekt_write_data(stream->ekt, auth_tag, tag_len, pkt_octet_len, 
-		      rdbx_get_packet_index(&stream->rtp_rdbx));
+		      srtp_rdbx_get_packet_index(&stream->rtp_rdbx));
 
   /* 
    * check sequence number for overruns, and copy it into the packet
    * if its value isn't too big
    */
-  status = rdb_increment(&stream->rtcp_rdb);
+  status = srtp_rdb_increment(&stream->rtcp_rdb);
   if (status)
     return status;
-  seq_num = rdb_get_value(&stream->rtcp_rdb);
+  seq_num = srtp_rdb_get_value(&stream->rtcp_rdb);
   *trailer |= htonl(seq_num);
   debug_print(mod_srtp, "srtcp index: %x", seq_num);
 
@@ -2931,7 +2931,7 @@
   /* this is easier than dealing with bitfield access */
   seq_num = ntohl(*trailer) & SRTCP_INDEX_MASK;
   debug_print(mod_srtp, "srtcp index: %x", seq_num);
-  status = rdb_check(&stream->rtcp_rdb, seq_num);
+  status = srtp_rdb_check(&stream->rtcp_rdb, seq_num);
   if (status)
     return status;
 
@@ -3054,7 +3054,7 @@
   }
 
   /* we've passed the authentication check, so add seq_num to the rdb */
-  rdb_add_index(&stream->rtcp_rdb, seq_num);
+  srtp_rdb_add_index(&stream->rtcp_rdb, seq_num);
     
     
   return srtp_err_status_ok;  
diff --git a/test/rdbx_driver.c b/test/rdbx_driver.c
index d745851..fe5336e 100644
--- a/test/rdbx_driver.c
+++ b/test/rdbx_driver.c
@@ -53,7 +53,7 @@
 #include "rdbx.h"
 
 #ifdef ROC_TEST
-#error "rdbx_t won't work with ROC_TEST - bitmask same size as seq_median"
+#error "srtp_rdbx_t won't work with ROC_TEST - bitmask same size as seq_median"
 #endif
 
 #include "ut_sim.h"
@@ -103,7 +103,7 @@
     usage(argv[0]);
 
   if (do_validation) {
-    printf("testing rdbx_t (ws=128)...\n");
+    printf("testing srtp_rdbx_t (ws=128)...\n");
 
     status = test_replay_dbx(1 << 12, 128);
     if (status) {
@@ -112,7 +112,7 @@
     }
     printf("passed\n");
 
-    printf("testing rdbx_t (ws=1024)...\n");
+    printf("testing srtp_rdbx_t (ws=1024)...\n");
 
     status = test_replay_dbx(1 << 12, 1024);
     if (status) {
@@ -133,7 +133,7 @@
 }
 
 void
-print_rdbx(rdbx_t *rdbx) {
+print_rdbx(srtp_rdbx_t *rdbx) {
   char buf[2048];
   printf("rdbx: {%llu, %s}\n",
 	 (unsigned long long)(rdbx->index),
@@ -151,13 +151,13 @@
  */
 
 srtp_err_status_t
-rdbx_check_add(rdbx_t *rdbx, uint32_t idx) {
+rdbx_check_add(srtp_rdbx_t *rdbx, uint32_t idx) {
   int delta;
-  xtd_seq_num_t est;
+  srtp_xtd_seq_num_t est;
   
-  delta = index_guess(&rdbx->index, &est, idx);
+  delta = srtp_index_guess(&rdbx->index, &est, idx);
   
-  if (rdbx_check(rdbx, delta) != srtp_err_status_ok) {
+  if (srtp_rdbx_check(rdbx, delta) != srtp_err_status_ok) {
     printf("replay_check failed at index %u\n", idx);
     return srtp_err_status_algo_fail;
   }
@@ -167,7 +167,7 @@
    * the estimated value est, at this point
    */
   
-  if (rdbx_add_index(rdbx, delta) != srtp_err_status_ok) {
+  if (srtp_rdbx_add_index(rdbx, delta) != srtp_err_status_ok) {
     printf("rdbx_add_index failed at index %u\n", idx);
     return srtp_err_status_algo_fail;
   }  
@@ -176,21 +176,21 @@
 }
 
 /*
- * rdbx_check_expect_failure(rdbx_t *rdbx, uint32_t idx)
+ * rdbx_check_expect_failure(srtp_rdbx_t *rdbx, uint32_t idx)
  * 
  * checks that a sequence number idx is in the replay database
  * and thus will be rejected
  */
 
 srtp_err_status_t
-rdbx_check_expect_failure(rdbx_t *rdbx, uint32_t idx) {
+rdbx_check_expect_failure(srtp_rdbx_t *rdbx, uint32_t idx) {
   int delta;
-  xtd_seq_num_t est;
+  srtp_xtd_seq_num_t est;
   srtp_err_status_t status;
 
-  delta = index_guess(&rdbx->index, &est, idx);
+  delta = srtp_index_guess(&rdbx->index, &est, idx);
 
-  status = rdbx_check(rdbx, delta);
+  status = srtp_rdbx_check(rdbx, delta);
   if (status == srtp_err_status_ok) {
     printf("delta: %d ", delta);
     printf("replay_check failed at index %u (false positive)\n", idx);
@@ -201,14 +201,14 @@
 }
 
 srtp_err_status_t
-rdbx_check_add_unordered(rdbx_t *rdbx, uint32_t idx) {
+rdbx_check_add_unordered(srtp_rdbx_t *rdbx, uint32_t idx) {
   int delta;
-  xtd_seq_num_t est;
+  srtp_xtd_seq_num_t est;
   srtp_err_status_t rstat;
 
-  delta = index_guess(&rdbx->index, &est, idx);
+  delta = srtp_index_guess(&rdbx->index, &est, idx);
 
-  rstat = rdbx_check(rdbx, delta);
+  rstat = srtp_rdbx_check(rdbx, delta);
   if ((rstat != srtp_err_status_ok) && (rstat != srtp_err_status_replay_old)) {
     printf("replay_check_add_unordered failed at index %u\n", idx);
     return srtp_err_status_algo_fail;
@@ -216,7 +216,7 @@
   if (rstat == srtp_err_status_replay_old) {
 	return srtp_err_status_ok;
   }
-  if (rdbx_add_index(rdbx, delta) != srtp_err_status_ok) {
+  if (srtp_rdbx_add_index(rdbx, delta) != srtp_err_status_ok) {
     printf("rdbx_add_index failed at index %u\n", idx);
     return srtp_err_status_algo_fail;
   }  
@@ -226,13 +226,13 @@
 
 srtp_err_status_t
 test_replay_dbx(int num_trials, unsigned long ws) {
-  rdbx_t rdbx;
+  srtp_rdbx_t rdbx;
   uint32_t idx, ircvd;
   ut_connection utc;
   srtp_err_status_t status;
   int num_fp_trials;
 
-  status = rdbx_init(&rdbx, ws);
+  status = srtp_rdbx_init(&rdbx, ws);
   if (status) {
     printf("replay_init failed with error code %d\n", status);
     exit(1);
@@ -269,9 +269,9 @@
   printf("passed\n");
 
   /* re-initialize */
-  rdbx_dealloc(&rdbx);
+  srtp_rdbx_dealloc(&rdbx);
 
-  if (rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
+  if (srtp_rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
     printf("replay_init failed\n");
     return srtp_err_status_init_fail;
   }
@@ -297,9 +297,9 @@
   printf("passed\n");
 
   /* re-initialize */
-  rdbx_dealloc(&rdbx);
+  srtp_rdbx_dealloc(&rdbx);
 
-  if (rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
+  if (srtp_rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
     printf("replay_init failed\n");
     return srtp_err_status_init_fail;
   }
@@ -319,7 +319,7 @@
   }
   printf("passed\n");
 
-  rdbx_dealloc(&rdbx);
+  srtp_rdbx_dealloc(&rdbx);
 
   return srtp_err_status_ok;
 }
@@ -333,12 +333,12 @@
 rdbx_check_adds_per_second(int num_trials, unsigned long ws) {
   uint32_t i;
   int delta;
-  rdbx_t rdbx;
-  xtd_seq_num_t est;
+  srtp_rdbx_t rdbx;
+  srtp_xtd_seq_num_t est;
   clock_t timer;
   int failures;                    /* count number of failures        */
   
-  if (rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
+  if (srtp_rdbx_init(&rdbx, ws) != srtp_err_status_ok) {
     printf("replay_init failed\n");
     exit(1);
   }  
@@ -347,19 +347,19 @@
   timer = clock();
   for(i=0; i < num_trials; i++) {
     
-    delta = index_guess(&rdbx.index, &est, i);
+    delta = srtp_index_guess(&rdbx.index, &est, i);
     
-    if (rdbx_check(&rdbx, delta) != srtp_err_status_ok) 
+    if (srtp_rdbx_check(&rdbx, delta) != srtp_err_status_ok) 
       ++failures;
     else
-      if (rdbx_add_index(&rdbx, delta) != srtp_err_status_ok)
+      if (srtp_rdbx_add_index(&rdbx, delta) != srtp_err_status_ok)
 	++failures;
   }
   timer = clock() - timer;
 
   printf("number of failures: %d \n", failures);
 
-  rdbx_dealloc(&rdbx);
+  srtp_rdbx_dealloc(&rdbx);
 
   return (double) CLOCKS_PER_SEC * num_trials / timer;
 }
diff --git a/test/replay_driver.c b/test/replay_driver.c
index a2b6dc4..b7d4c0d 100644
--- a/test/replay_driver.c
+++ b/test/replay_driver.c
@@ -69,7 +69,7 @@
 main (void) {
   srtp_err_status_t err;
   
-  printf("testing anti-replay database (rdb_t)...\n");
+  printf("testing anti-replay database (srtp_rdb_t)...\n");
   err = test_rdb_db();
   if (err) {
     printf("failed\n");
@@ -85,18 +85,18 @@
 
 
 void
-print_rdb(rdb_t *rdb) {
+print_rdb(srtp_rdb_t *rdb) {
   printf("rdb: {%u, %s}\n", rdb->window_start, v128_bit_string(&rdb->bitmask));
 }
 
 srtp_err_status_t
-rdb_check_add(rdb_t *rdb, uint32_t idx) {
+rdb_check_add(srtp_rdb_t *rdb, uint32_t idx) {
 
-  if (rdb_check(rdb, idx) != srtp_err_status_ok) {
+  if (srtp_rdb_check(rdb, idx) != srtp_err_status_ok) {
     printf("rdb_check failed at index %u\n", idx);
     return srtp_err_status_fail;
   }
-  if (rdb_add_index(rdb, idx) != srtp_err_status_ok) {
+  if (srtp_rdb_add_index(rdb, idx) != srtp_err_status_ok) {
     printf("rdb_add_index failed at index %u\n", idx);
     return srtp_err_status_fail;
   }
@@ -105,10 +105,10 @@
 }
 
 srtp_err_status_t
-rdb_check_expect_failure(rdb_t *rdb, uint32_t idx) {
+rdb_check_expect_failure(srtp_rdb_t *rdb, uint32_t idx) {
   srtp_err_status_t err;
   
-  err = rdb_check(rdb, idx);
+  err = srtp_rdb_check(rdb, idx);
   if ((err != srtp_err_status_replay_old) && (err != srtp_err_status_replay_fail)) {
     printf("rdb_check failed at index %u (false positive)\n", idx);
     return srtp_err_status_fail;
@@ -118,11 +118,11 @@
 }
 
 srtp_err_status_t
-rdb_check_add_unordered(rdb_t *rdb, uint32_t idx) {
+rdb_check_add_unordered(srtp_rdb_t *rdb, uint32_t idx) {
   srtp_err_status_t rstat;
 
  /* printf("index: %u\n", idx); */
-  rstat = rdb_check(rdb, idx);
+  rstat = srtp_rdb_check(rdb, idx);
   if ((rstat != srtp_err_status_ok) && (rstat != srtp_err_status_replay_old)) {
     printf("rdb_check_add_unordered failed at index %u\n", idx);
     return rstat;
@@ -130,7 +130,7 @@
   if (rstat == srtp_err_status_replay_old) {
 	return srtp_err_status_ok;
   }
-  if (rdb_add_index(rdb, idx) != srtp_err_status_ok) {
+  if (srtp_rdb_add_index(rdb, idx) != srtp_err_status_ok) {
     printf("rdb_add_index failed at index %u\n", idx);
     return srtp_err_status_fail;
   }  
@@ -140,12 +140,12 @@
 
 srtp_err_status_t
 test_rdb_db() {
-  rdb_t rdb;
+  srtp_rdb_t rdb;
   uint32_t idx, ircvd;
   ut_connection utc;
   srtp_err_status_t err;
 
-  if (rdb_init(&rdb) != srtp_err_status_ok) {
+  if (srtp_rdb_init(&rdb) != srtp_err_status_ok) {
     printf("rdb_init failed\n");
     return srtp_err_status_init_fail;
   }
@@ -165,7 +165,7 @@
   }
 
   /* re-initialize */
-  if (rdb_init(&rdb) != srtp_err_status_ok) {
+  if (srtp_rdb_init(&rdb) != srtp_err_status_ok) {
     printf("rdb_init failed\n");
     return srtp_err_status_fail;
   }
@@ -184,7 +184,7 @@
   }
 
   /* re-initialize */
-  if (rdb_init(&rdb) != srtp_err_status_ok) {
+  if (srtp_rdb_init(&rdb) != srtp_err_status_ok) {
     printf("rdb_init failed\n");
     return srtp_err_status_fail;
   }
@@ -200,7 +200,7 @@
   }
 
   /* re-initialize */
-  if (rdb_init(&rdb) != srtp_err_status_ok) {
+  if (srtp_rdb_init(&rdb) != srtp_err_status_ok) {
     printf("rdb_init failed\n");
     return srtp_err_status_fail;
   }
@@ -231,28 +231,28 @@
 double
 rdb_check_adds_per_second(void) {
   uint32_t i;
-  rdb_t rdb;
+  srtp_rdb_t rdb;
   clock_t timer;
   int failures;                    /* count number of failures        */
   
-  if (rdb_init(&rdb) != srtp_err_status_ok) {
+  if (srtp_rdb_init(&rdb) != srtp_err_status_ok) {
     printf("rdb_init failed\n");
     exit(1);
   }  
 
   timer = clock();
   for(i=0; i < REPLAY_NUM_TRIALS; i+=3) {
-    if (rdb_check(&rdb, i+2) != srtp_err_status_ok)
+    if (srtp_rdb_check(&rdb, i+2) != srtp_err_status_ok)
       ++failures;
-    if (rdb_add_index(&rdb, i+2) != srtp_err_status_ok)
+    if (srtp_rdb_add_index(&rdb, i+2) != srtp_err_status_ok)
       ++failures;
-    if (rdb_check(&rdb, i+1) != srtp_err_status_ok)
+    if (srtp_rdb_check(&rdb, i+1) != srtp_err_status_ok)
       ++failures;
-    if (rdb_add_index(&rdb, i+1) != srtp_err_status_ok)
+    if (srtp_rdb_add_index(&rdb, i+1) != srtp_err_status_ok)
       ++failures;
-    if (rdb_check(&rdb, i) != srtp_err_status_ok)
+    if (srtp_rdb_check(&rdb, i) != srtp_err_status_ok)
       ++failures;
-    if (rdb_add_index(&rdb, i) != srtp_err_status_ok)
+    if (srtp_rdb_add_index(&rdb, i) != srtp_err_status_ok)
       ++failures;
   }
   timer = clock() - timer;
diff --git a/test/roc_driver.c b/test/roc_driver.c
index d75b58f..70e16b4 100644
--- a/test/roc_driver.c
+++ b/test/roc_driver.c
@@ -52,7 +52,7 @@
 
 /*
  * defining ROC_TEST causes small datatypes to be used in
- * xtd_seq_num_t - this allows the functions to be exhaustively tested.
+ * srtp_xtd_seq_num_t - this allows the functions to be exhaustively tested.
  */
 #if ROC_NEEDS_TO_BE_TESTED
 #define ROC_TEST     
@@ -87,20 +87,20 @@
 
 srtp_err_status_t
 roc_test(int num_trials) {
-  xtd_seq_num_t local, est, ref;
+  srtp_xtd_seq_num_t local, est, ref;
   ut_connection utc;
   int i, num_bad_est = 0;
   int delta;
   uint32_t ircvd;
   double failure_rate;
 
-  index_init(&local);
-  index_init(&ref);
-  index_init(&est);
+  srtp_index_init(&local);
+  srtp_index_init(&ref);
+  srtp_index_init(&est);
 
   printf("\n\ttesting sequential insertion...");
   for (i=0; i < 2048; i++) {
-    delta = index_guess(&local, &est, (uint16_t) ref);
+    delta = srtp_index_guess(&local, &est, (uint16_t) ref);
 #if ROC_VERBOSE
     printf("%lld, %lld, %d\n", ref, est,  i);
 #endif
@@ -110,7 +110,7 @@
 #endif
       ++num_bad_est;
     }
-    index_advance(&ref, 1);
+    srtp_index_advance(&ref, 1);
   }
   failure_rate = (double) num_bad_est / num_trials;
   if (failure_rate > 0.01) {
@@ -122,9 +122,9 @@
 
 
   printf("\ttesting non-sequential insertion...");
-  index_init(&local);
-  index_init(&ref);
-  index_init(&est);
+  srtp_index_init(&local);
+  srtp_index_init(&ref);
+  srtp_index_init(&est);
   ut_init(&utc);
   
   for (i=0; i < num_trials; i++) {
@@ -136,7 +136,7 @@
     ref = ircvd; 
 
     /* estimate index based on low bits of ircvd */
-    delta = index_guess(&local, &est, (uint16_t) ref);
+    delta = srtp_index_guess(&local, &est, (uint16_t) ref);
 #if ROC_VERBOSE
     printf("ref: %lld, local: %lld, est: %lld, ircvd: %d, delta: %d\n", 
 	   ref, local, est, ircvd, delta);
@@ -148,9 +148,9 @@
       return srtp_err_status_algo_fail;
     }
 
-    /* now update local xtd_seq_num_t as necessary */
+    /* now update local srtp_xtd_seq_num_t as necessary */
     if (delta > 0) 
-      index_advance(&local, delta);
+      srtp_index_advance(&local, delta);
 
     if (ref != est) {
 #if ROC_VERBOSE
diff --git a/test/srtp_driver.c b/test/srtp_driver.c
index ab9dd6a..0406489 100644
--- a/test/srtp_driver.c
+++ b/test/srtp_driver.c
@@ -1094,7 +1094,7 @@
                stream->rtcp_cipher->type->description,
                stream->rtcp_auth->type->description,
                serv_descr[stream->rtcp_services],
-               rdbx_get_window_size(&stream->rtp_rdbx),
+               srtp_rdbx_get_window_size(&stream->rtp_rdbx),
                stream->allow_repeat_tx ? "true" : "false");
     }
 
@@ -1121,7 +1121,7 @@
                stream->rtcp_cipher->type->description,
                stream->rtcp_auth->type->description,
                serv_descr[stream->rtcp_services],
-               rdbx_get_window_size(&stream->rtp_rdbx),
+               srtp_rdbx_get_window_size(&stream->rtp_rdbx),
                stream->allow_repeat_tx ? "true" : "false");
 
         /* advance to next stream in the list */