private void ProcessDAAdvert(DirectoryAgentAdvertPacket da, IPEndPoint source) { //We should only register with directory agents that either support our scope or those which support all scopes (the scope list is empty). if (da.ScopeList.Count != 0 && !da.ScopeList.Contains(Scope)) { return; } //Determine if we have previously registered with this DA and if not raise a new DA found event. if (!DirectoryAgents.ContainsKey(da.Url)) { //Add this DA to the list of DAs we subscribe to. DirectoryAgents[da.Url] = new DirectoryAgentInformation(da.Url, source);; //Notify Subscribers that a new DA has been found. RaiseNewDirectoryAgentFound(); } //Register with the DA. ServiceRegistrationPacket register = new ServiceRegistrationPacket(); FillHeader(register.Header, da.Header.XId); register.Header.Flags |= SlpHeaderFlags.Fresh; register.Url = new UrlEntry(ServiceUrl); register.ServiceType = ServiceType; register.ScopeList = Scope; register.AttrList = AttributeString; socket.Send(source, register); }
protected override void ProcessPacket(NewPacketEventArgs packetInfo) { DirectoryAgentAdvertPacket advert = packetInfo.Packet as DirectoryAgentAdvertPacket; if (advert != null) { ProcessDAAdvert(advert, packetInfo.SourceEndPoint); } ServiceRequestPacket request = packetInfo.Packet as ServiceRequestPacket; if (IsReplyRequired(request)) { SendServiceReply(packetInfo.SourceEndPoint, packetInfo.Packet.Header.XId); } ServiceAcknowledgePacket acknowledge = packetInfo.Packet as ServiceAcknowledgePacket; if (acknowledge != null) { RaiseServiceRegistered(); } AttributeRequestPacket attributeRequest = packetInfo.Packet as AttributeRequestPacket; if (IsReplyRequired(attributeRequest)) { SendAttributeReply(packetInfo.SourceEndPoint, packetInfo.Packet.Header.XId); } }
private void ProcessDAAdvert(DirectoryAgentAdvertPacket da, IPEndPoint source) { if (!DirectoryAgents.ContainsKey(da.Url)) { //Add this DA to the list of DAs we subscribe to. DirectoryAgents[da.Url] = new DirectoryAgentInformation(da.Url, source);; //Notify Subscribers that a new DA has been found. RaiseNewDirectoryAgentFound(); } //Register with the DA. ServiceRegistrationPacket register = new ServiceRegistrationPacket(); FillHeader(register.Header, da.Header.XId); register.Header.Flags |= SlpHeaderFlags.Fresh; register.Url = new UrlEntry(ServiceUrl); register.ServiceType = ServiceType; register.ScopeList = Scope; socket.Send(source, register); }
protected override void ProcessPacket(NewPacketEventArgs packetInfo) { DirectoryAgentAdvertPacket daAdvert = packetInfo.Packet as DirectoryAgentAdvertPacket; if (daAdvert != null) { DirectoryAgent = new DirectoryAgentInformation(daAdvert.Url, packetInfo.SourceEndPoint); } ServiceReplyPacket serviceReply = packetInfo.Packet as ServiceReplyPacket; if (serviceReply != null) { ProcessServiceReply(serviceReply, packetInfo.SourceEndPoint); } AttributeReplyPacket attributeReply = packetInfo.Packet as AttributeReplyPacket; if (attributeReply != null) { ProcessAttributeReply(attributeReply, packetInfo.SourceEndPoint); } }