Documentation
¶
Index ¶
- Constants
- func ParseFromIncomingMessage(b []byte) (salt, sessionId int64, msg2 *mtproto.TLMessage2, err error)
- func SerializeToBuffer(salt, sessionId int64, msg2 *mtproto.TLMessage2, layer int32) []byte
- func SerializeToBuffer2(salt, sessionId int64, msg2 *mtproto.TLMessageRawData) []byte
- type Gateway
- type RequestManager
- type Service
- func (s *Service) Close() error
- func (s *Service) DeleteByAuthKeyId(authKeyId int64)
- func (s *Service) Ping(ctx context.Context) (err error)
- func (s *Service) SendDataToGateway(ctx context.Context, gatewayId string, authKeyId, salt, sessionId int64, ...) (bool, error)
- func (s *Service) SendHttpDataToGateway(ctx context.Context, ch chan interface{}, authKeyId, salt, sessionId int64, ...) (bool, error)
- func (s *Service) SessionCloseSession(ctx context.Context, r *sessionpb.TLSessionCloseSession) (*mtproto.Bool, error)
- func (s *Service) SessionCreateSession(ctx context.Context, r *sessionpb.TLSessionCreateSession) (*mtproto.Bool, error)
- func (s *Service) SessionPushRpcResultData(ctx context.Context, r *sessionpb.TLSessionPushRpcResultData) (*mtproto.Bool, error)
- func (s *Service) SessionPushSessionUpdatesData(ctx context.Context, r *sessionpb.TLSessionPushSessionUpdatesData) (*mtproto.Bool, error)
- func (s *Service) SessionPushUpdatesData(ctx context.Context, r *sessionpb.TLSessionPushUpdatesData) (*mtproto.Bool, error)
- func (s *Service) SessionQueryAuthKey(ctx context.Context, r *sessionpb.TLSessionQueryAuthKey) (*mtproto.AuthKeyInfo, error)
- func (s *Service) SessionSendDataToSession(ctx context.Context, r *sessionpb.TLSessionSendDataToSession) (res *mtproto.Bool, err error)
- func (s *Service) SessionSendHttpDataToSession(ctx context.Context, r *sessionpb.TLSessionSendHttpDataToSession) (res *sessionpb.HttpSessionData, err error)
- func (s *Service) SessionSetAuthKey(ctx context.Context, r *sessionpb.TLSessionSetAuthKey) (*mtproto.Bool, error)
Constants ¶
View Source
const ( NONE byte = 0 UNKNOWN byte = 1 NOT_RECEIVED byte = 2 NOT_RECEIVED_SURE byte = 3 RECEIVED byte = 4 ACKNOWLEDGED byte = 8 NEED_NO_ACK byte = 16 RPC_PROCESSING byte = 32 RESPONSE_GENERATED byte = 64 RESPONSE_ACKNOWLEDGED byte = 128 )
case mtpc_msgs_state_req: { if (badTime) { DEBUG_LOG(("Message Info: skipping with bad time...")); return HandleResult::Ignored; } MTPMsgsStateReq msg; msg.read(from, end); auto &ids = msg.c_msgs_state_req().vmsg_ids.v; auto idsCount = ids.size(); DEBUG_LOG(("Message Info: msgs_state_req received, ids: %1").arg(LogIdsVector(ids))); if (!idsCount) return HandleResult::Success; QByteArray info(idsCount, Qt::Uninitialized); { QReadLocker lock(sessionData->receivedIdsMutex()); auto &receivedIds = sessionData->receivedIdsSet(); auto minRecv = receivedIds.min(); auto maxRecv = receivedIds.max(); QReadLocker locker(sessionData->wereAckedMutex()); const auto &wereAcked = sessionData->wereAckedMap(); const auto wereAckedEnd = wereAcked.cend(); for (uint32 i = 0, l = idsCount; i < l; ++i) { char state = 0; uint64 reqMsgId = ids[i].v; if (reqMsgId < minRecv) { state |= 0x01; } else if (reqMsgId > maxRecv) { state |= 0x03; } else { auto msgIdState = receivedIds.lookup(reqMsgId); if (msgIdState == ReceivedMsgIds::State::NotFound) { state |= 0x02; } else { state |= 0x04; if (wereAcked.constFind(reqMsgId) != wereAckedEnd) { state |= 0x80; // we know, that server knows, that we received request } if (msgIdState == ReceivedMsgIds::State::NeedsAck) { // need ack, so we sent ack state |= 0x08; } else { state |= 0x10; } } } info[i] = state; } } emit sendMsgsStateInfoAsync(msgId, info); } return HandleResult::Success; 1 = nothing is known about the message (msg_id too low, the other party may have forgotten it) 2 = message not received (msg_id falls within the range of stored identifiers; however, the other party has certainly not received a message like that) 3 = message not received (msg_id too high; however, the other party has certainly not received it yet) 4 = message received (note that this response is also at the same time a receipt acknowledgment) +8 = message already acknowledged +16 = message not requiring acknowledgment +32 = RPC query contained in message being processed or processing already complete +64 = content-related response to message already generated +128 = other party knows for a fact that message is already received
Variables ¶
This section is empty.
Functions ¶
func ParseFromIncomingMessage ¶
func ParseFromIncomingMessage(b []byte) (salt, sessionId int64, msg2 *mtproto.TLMessage2, err error)
func SerializeToBuffer ¶
func SerializeToBuffer(salt, sessionId int64, msg2 *mtproto.TLMessage2, layer int32) []byte
func SerializeToBuffer2 ¶
func SerializeToBuffer2(salt, sessionId int64, msg2 *mtproto.TLMessageRawData) []byte
Types ¶
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway eGateClient is a gateway.
type RequestManager ¶
type RequestManager struct {
// contains filtered or unexported fields
}
func NewRequestManager ¶
func NewRequestManager() *RequestManager
type Service ¶
func (*Service) DeleteByAuthKeyId ¶
func (*Service) SendDataToGateway ¶
func (*Service) SendHttpDataToGateway ¶
func (*Service) SessionCloseSession ¶
func (*Service) SessionCreateSession ¶
func (*Service) SessionPushRpcResultData ¶
func (*Service) SessionPushSessionUpdatesData ¶
func (s *Service) SessionPushSessionUpdatesData(ctx context.Context, r *sessionpb.TLSessionPushSessionUpdatesData) (*mtproto.Bool, error)
SessionPushSessionUpdatesData RPCPushClient is the client API for RPCPush service.
func (*Service) SessionPushUpdatesData ¶
func (s *Service) SessionPushUpdatesData(ctx context.Context, r *sessionpb.TLSessionPushUpdatesData) (*mtproto.Bool, error)
SessionPushUpdatesData RPCPushClient is the client API for RPCPush service.
func (*Service) SessionQueryAuthKey ¶
func (s *Service) SessionQueryAuthKey(ctx context.Context, r *sessionpb.TLSessionQueryAuthKey) (*mtproto.AuthKeyInfo, error)
func (*Service) SessionSendDataToSession ¶
func (*Service) SessionSendHttpDataToSession ¶
func (s *Service) SessionSendHttpDataToSession(ctx context.Context, r *sessionpb.TLSessionSendHttpDataToSession) (res *sessionpb.HttpSessionData, err error)
func (*Service) SessionSetAuthKey ¶
Source Files
¶
- auth_sessions.go
- check_api_request_type.go
- check_message_cofirm.go
- gateway.go
- ip.go
- message_pack_util.go
- msg_id.go
- request_cache.go
- service.go
- service_gateway.go
- service_push.go
- session.go
- session_http_queue.go
- session_inbound_queue.go
- session_invoke.go
- session_outgoing_queue.go
- session_push_queue.go
- session_service_messages.go
- session_service_messages_about_messages.go
- session_sync.go
- session_waiting_result_queue.go
Click to show internal directories.
Click to hide internal directories.