def send_msg(self, msg_type, ies):
"""
Encodes and sends the message to the IPA layer.
"""
# Calc the maximum length possible for the message, and allocate memory
buf_size = _GSUP.get_max_bytes(ies)
(buf, offset) = self._ipa_writer.get_write_buf(buf_size)
try:
msg_len = _GSUP.encode(buf, offset, msg_type, ies)
except GSUPCodecError as err:
# Encoding should always succeed
logging.fatal(
"Encoding failed with err: %s, for msg: %s, ies: %s",
err, msg_type, ies)
return
# Reset the length in the IPA header based on actual msg size
self._ipa_writer.reset_length(buf, msg_len - offset)
# Write the encoded msg
self._ipa_writer.write(buf[:msg_len])
gsup.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录