ot::Utils::SrpClientBuffers::AllocateService() method
Allocates a new service entry from the pool. The returned service entry instance will be initialized as follows: - `mService.mName` points to a string buffer which can be retrieved using `GetServiceNameString()`. - `mService.mInstanceName` points to a string buffer which can be retrieved using `GetInstanceNameString()`. - `mService.mSubTypeLabels` points to array which can be retrieved using `GetSubTypeLabelsArray()`. - `mService.mTxtEntries` points to `mTxtEntry`. - `mService.mNumTxtEntries` is set to one (one entry in the list). - Other `mService` fields (port, priority, weight) are set to zero. - `mTxtEntry.mKey` is set to `nullptr` (value is treated as already encoded data). - `mTxtEntry.mValue` points to a buffer which can be retrieved using `GetTxtBuffer()` - `mTxtEntry.mValueLength` is set to zero. - All related data/string buffers and arrays are cleared to all zero.
Return value
A pointer to the newly allocated service entry or `nullptr` if not more entry available in the pool.
ot::Utils::SrpClientBuffers::AllocateService() reads 6 variables and writes 6 variables:
![]()
ot::Utils::SrpClientBuffers::AllocateService()