⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 session.h

📁 本人收集整理的一份c/c++跨平台网络库
💻 H
📖 第 1 页 / 共 2 页
字号:
  void DestroyChannel(TransportChannel* channel);  // Note: This function is a hack and should not be used.  TransportChannelImpl* GetImplementation(TransportChannel* channel);  // Invoked when we notice that there is no matching channel on our peer.  sigslot::signal2<Session*, const std::string&> SignalChannelGone; private:  typedef std::list<Transport*> TransportList;  typedef std::map<std::string, TransportChannelProxy*> ChannelMap;  SessionManager *session_manager_;  std::string name_;  std::string remote_name_;  bool initiator_;  SessionID id_;  std::string session_type_;  SessionClient* client_;  const SessionDescription *description_;  const SessionDescription *remote_description_;  State state_;  Error error_;  std::string redirect_target_;  // Note that the following two members are mutually exclusive  TransportList potential_transports_; // order implies preference  Transport* transport_;  // negotiated transport  ChannelMap channels_;  bool compatibility_mode_;  // indicates talking to an old client  XmlElements candidates_;  // holds candidates sent in case of compat-mode  // Creates or destroys a session.  (These are called only SessionManager.)  Session(SessionManager *session_manager,          const std::string& name,          const SessionID& id,          const std::string& session_type,          SessionClient* client);  ~Session();  // Updates the state, signaling if necessary.  void SetState(State state);  // Updates the error state, signaling if necessary.  void SetError(Error error);  // To improve connection time, this creates the channels on the most common  // transport type and initiates connection.  void ConnectDefaultTransportChannels(bool create);  // If a new channel is created after we have created the default transport,  // then we should create this channel as well and let it connect.  void CreateDefaultTransportChannel(const std::string& name);  // Creates a default set of transports if the client did not specify some.  void CreateTransports();  // Attempts to choose a transport that is in both our list and the other  // clients.  This will examine the children of the given XML element to find  // the descriptions of the other client's transports.  We will pick the first  // transport in the other client's list that we also support.  // (This is called only by SessionManager.)  bool ChooseTransport(const buzz::XmlElement* msg);  // Called when a single transport has been negotiated.  void SetTransport(Transport* transport);  // Called when the first channel of a transport begins connecting.  We use  // this to start a timer, to make sure that the connection completes in a  // reasonable amount of time.  void OnTransportConnecting(Transport* transport);  // Called when a transport changes its writable state.  We track this to make  // sure that the transport becomes writable within a reasonable amount of  // time.  If this does not occur, we signal an error.  void OnTransportWritable(Transport* transport);  // Called when a transport requests signaling.  void OnTransportRequestSignaling(Transport* transport);  // Called when a transport signals that it has a message to send.   Note that  // these messages are just the transport part of the stanza; they need to be  // wrapped in the appropriate session tags.  void OnTransportSendMessage(Transport* transport, const XmlElements& elems);  // Called when a transport signals that it found an error in an incoming  // message.  void OnTransportSendError(Transport* transport,                            const buzz::XmlElement* stanza,                            const buzz::QName& name,                            const std::string& type,                            const std::string& text,                            const buzz::XmlElement* extra_info);  // Called when we notice that one of our local channels has no peer, so it  // should be destroyed.  void OnTransportChannelGone(Transport* transport, const std::string& name);  // When the session needs to send signaling messages, it beings by requesting  // signaling.  The client should handle this by calling OnSignalingReady once  // it is ready to send the messages.  // (These are called only by SessionManager.)  sigslot::signal1<Session*> SignalRequestSignaling;  void OnSignalingReady();  // Sends a message of the given type to the other client.  The body will  // contain the given list of elements (which are consumed by the function).  void SendSessionMessage(const std::string& type,                          const XmlElements& elems);  // Sends a message back to the other client indicating that we have received  // and accepted their message.  void SendAcknowledgementMessage(const buzz::XmlElement* stanza);  // Once signaling is ready, the session will use this signal to request the  // sending of each message.  When messages are received by the other client,  // they should be handed to OnIncomingMessage.  // (These are called only by SessionManager.)  sigslot::signal2<Session *, const buzz::XmlElement*> SignalOutgoingMessage;  void OnIncomingMessage(const buzz::XmlElement* stanza);  void OnFailedSend(const buzz::XmlElement* orig_stanza,                    const buzz::XmlElement* error_stanza);  // Invoked when an error is found in an incoming message.  This is translated  // into the appropriate XMPP response by SessionManager.  sigslot::signal6<Session*,                   const buzz::XmlElement*,                   const buzz::QName&,                   const std::string&,                   const std::string&,                   const buzz::XmlElement*> SignalErrorMessage;  // Handlers for the various types of messages.  These functions may take  // pointers to the whole stanza or to just the session element.  bool OnInitiateMessage(const buzz::XmlElement* stanza,                         const buzz::XmlElement* session);  bool OnAcceptMessage(const buzz::XmlElement* stanza,                       const buzz::XmlElement* session);  bool OnRejectMessage(const buzz::XmlElement* stanza,                       const buzz::XmlElement* session);  bool OnRedirectMessage(const buzz::XmlElement* stanza,                         const buzz::XmlElement* session);  bool OnInfoMessage(const buzz::XmlElement* stanza,                     const buzz::XmlElement* session);  bool OnTransportAcceptMessage(const buzz::XmlElement* stanza,                                const buzz::XmlElement* session);  bool OnTransportInfoMessage(const buzz::XmlElement* stanza,                              const buzz::XmlElement* session);  bool OnTerminateMessage(const buzz::XmlElement* stanza,                          const buzz::XmlElement* session);  bool OnCandidatesMessage(const buzz::XmlElement* stanza,                           const buzz::XmlElement* session);  // Helper functions for parsing various message types.  CheckState verifies  // that we are in the appropriate state to receive this message.  The latter  // three verify that an element has the required child or attribute.  bool CheckState(const buzz::XmlElement* stanza, State state);  bool FindRequiredElement(const buzz::XmlElement* stanza,                           const buzz::XmlElement* parent,                           const buzz::QName& name,                           const buzz::XmlElement** elem);  bool FindRemoteSessionDescription(const buzz::XmlElement* stanza,                                    const buzz::XmlElement* session);  bool FindRequiredAttribute(const buzz::XmlElement* stanza,                             const buzz::XmlElement* elem,                             const buzz::QName& name,                             std::string* value);  // Handles messages posted to us.  void OnMessage(talk_base::Message *pmsg);  friend class SessionManager;  // For access to constructor, destructor,                                // and signaling related methods.};} // namespace cricket#endif // _SESSION_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -