I think this question is so trivial that it's nowhere explained (I would not find it) and the answer is probably trivial too. But I still wonder how codes in a typical CDMA system are distributed? They act like symmetric keys in a crypto system: both parties need to know them and there is a complexity of O(N) to share them (N being all possible users).
For example, in a WCDMA cellphone system, there is an "infinite" number N of possible nodes (e.g. a roaming user coming to the US). The codes can't be statically assigned. And the wireless base station can't just try all possible codes.
So I assume that the first communication of a handset and base station does not go over CDMA but the base station somehow detects that there is a new handset, creates a new code and sends this code to the handset. Afterwards the communication goes over CDMA. For handover between different stations, the base station could distribute the code among its neighbor stations.
How does it work in practice? And am I correct that the seed to an LSFR generating the chipping sequence is distributed as opposed to the chipping sequence itself?