public ApplicationId asApplicationId() { return authApplicationId != null ? ApplicationId.createByAuthAppId(vendorId, authApplicationId) : ApplicationId.createByAccAppId(vendorId, acctApplicationId); }
protected long getAppId(ApplicationId appId) { if (appId == null) { return 0; } // if (appId.getVendorId() == 0) { if (appId.getAcctAppId() != 0) { return appId.getAcctAppId(); } if (appId.getAuthAppId() != 0) { return appId.getAuthAppId(); } // } return appId.getVendorId(); } }
protected Set<ApplicationId> getCommonApplicationIds(IMessage message) { //TODO: fix this, its not correct lookup. It should check realm! //it does not include application Ids for which listeners register - and on this basis it consume message! Set<ApplicationId> newAppId = new HashSet<ApplicationId>(); Set<ApplicationId> locAppId = metaData.getLocalPeer().getCommonApplications(); List<ApplicationId> remAppId = message.getApplicationIdAvps(); logger.debug("Checking common applications. Remote applications: {}. Local applications: {}", remAppId, locAppId); // check common application for (ApplicationId l : locAppId) { for (ApplicationId r : remAppId) { if (l.equals(r)) { newAppId.add(l); } else if (r.getAcctAppId() == INT_COMMON_APP_ID || r.getAuthAppId() == INT_COMMON_APP_ID || l.getAcctAppId() == INT_COMMON_APP_ID || l.getAuthAppId() == INT_COMMON_APP_ID) { newAppId.add(r); } } } return newAppId; }
private void performBeforeReturnRo(RoClientSessionActivityImpl acc, Session session) { RoMessageFactoryImpl messageFactory = new RoMessageFactoryImpl(baseMessageFactory, session.getSessionId(), stack); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = authApplicationIds.get(0); messageFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId()); acc.setRoMessageFactory(messageFactory); // acc.setRoAvpFactory(roAvpFactory); }
@Override public ApplicationId getApplicationId() { return ApplicationId.createByAuthAppId(authAppId); }
if (firstWithZeroVendor == null && id.getVendorId() == 0 && (applicationId == id.getAuthAppId() || applicationId == id.getAcctAppId())) { firstWithZeroVendor = id; if (firstWithNonZeroVendor == null && id.getVendorId() != 0 && (applicationId == id.getAuthAppId() || applicationId == id.getAcctAppId())) { firstWithNonZeroVendor = id; break; toReturn = ApplicationId.createByAuthAppId(this.applicationId);
public CxDxClientSessionActivity createCxDxClientSessionActivity(DiameterIdentity destinationHost, DiameterIdentity destinationRealm) throws CreateActivityException { try { ClientCxDxSession session = ((ISessionFactory) stack.getSessionFactory()).getNewAppSession(null, ApplicationId.createByAuthAppId(DiameterCxDxAvpCodes.CXDX_VENDOR_ID, DiameterCxDxAvpCodes.CXDX_AUTH_APP_ID), ClientCxDxSession.class); CxDxMessageFactoryImpl sessionMsgFactory = new CxDxMessageFactoryImpl(this.ra.baseMessageFactory,session.getSessions().get(0), stack, new DiameterIdentity[]{}); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = authApplicationIds.get(0); sessionMsgFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId()); CxDxClientSessionImpl activity = new CxDxClientSessionImpl(sessionMsgFactory, ra.cxdxAvpFactory, session, (EventListener<Request, Answer>) session, destinationHost, destinationRealm, ra.sleeEndpoint); addActivity(activity, false /*true*/); return activity; } catch (Exception e) { throw new CreateActivityException("Internal exception while creating Client Accounting Activity", e); } }
Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId();
private void performBeforeReturnRf(RfClientSessionActivityImpl ac) { // we just have to set factory RfMessageFactoryImpl rfMessageFactory = new RfMessageFactoryImpl(baseMessageFactory, ac.getSessionId(),stack); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = acctApplicationIds.get(0); rfMessageFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAcctAppId()); ac.setRfMessageFactory(rfMessageFactory); }
public void setApplicationId(long vendorId, long applicationId) { this.rfAppId = ApplicationId.createByAccAppId(vendorId, applicationId); }
public long getApplicationId() { return authApplicationIds.get(0).getAuthAppId(); }
private void doFireEvent(AppSession appSession, Message message) { ApplicationId appId = null; for(ApplicationId curAppId : message.getApplicationIdAvps()) { if(curAppId.getAcctAppId() != ApplicationId.UNDEFINED_VALUE && this.ras.containsKey(curAppId)) { appId = curAppId; break; } } DiameterRAInterface ra = appId != null ? this.ras.get(appId) : this.ras.values().iterator().next(); if(ra != null) { ra.fireEvent(appSession.getSessions().get(0).getSessionId(), message); } else { // TODO: tracer } } }
private void performBeforeReturnRo(RoServerSessionActivityImpl acc, Session session) { RoMessageFactoryImpl messageFactory = new RoMessageFactoryImpl(baseMessageFactory, session.getSessionId(), stack); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = authApplicationIds.get(0); messageFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId()); acc.setRoMessageFactory(messageFactory); // acc.setRoAvpFactory(roAvpFactory); }
@Override public ApplicationId getApplicationId() { return ApplicationId.createByAuthAppId(authAppId); }
long acc = a.getLongValue(AcctApplId.ordinal(), 0); if (auth != 0) { appId = org.jdiameter.api.ApplicationId.createByAuthAppId(vnd, auth); appId = org.jdiameter.api.ApplicationId.createByAccAppId(vnd, acc); new Object[]{name, appId.getAcctAppId(), appId.getAuthAppId(), appId.getVendorId()});
private CxDxClientSessionActivity createCxDxClientSessionActivity(final Request request, final boolean suspend) throws CreateActivityException { try { String sessionId = request == null? null: request.getSessionId(); ClientCxDxSession session = ((ISessionFactory) stack.getSessionFactory()).getNewAppSession(sessionId, ApplicationId.createByAuthAppId(DiameterCxDxAvpCodes.CXDX_VENDOR_ID, DiameterCxDxAvpCodes.CXDX_AUTH_APP_ID), ClientCxDxSession.class); CxDxMessageFactoryImpl sessionMsgFactory = new CxDxMessageFactoryImpl(this.ra.baseMessageFactory,session.getSessions().get(0), stack, new DiameterIdentity[]{}); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = authApplicationIds.get(0); sessionMsgFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId()); CxDxClientSessionImpl activity = new CxDxClientSessionImpl(sessionMsgFactory, ra.cxdxAvpFactory, session, (EventListener<Request, Answer>) session, null, null, ra.sleeEndpoint); addActivity(activity, suspend); if(request != null) { if(request.getCommandCode() == PushProfileRequest.COMMAND_CODE) { activity.fetchSessionData(new PushProfileRequestImpl(request)); } else if (request.getCommandCode() == RegistrationTerminationRequest.COMMAND_CODE) { activity.fetchSessionData(new RegistrationTerminationRequestImpl(request)); } ((org.jdiameter.client.impl.app.cxdx.CxDxClientSessionImpl)session).processRequest(request); } return activity; } catch (Exception e) { throw new CreateActivityException("Internal exception while creating Client Accounting Activity", e); } }
Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId();
private void performBeforeReturnRf(RfServerSessionActivityImpl ac) { // we just have to set factory RfMessageFactoryImpl rfMessageFactory = new RfMessageFactoryImpl(baseMessageFactory,ac.getSessionId(), stack); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = acctApplicationIds.get(0); rfMessageFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAcctAppId()); ac.setRfMessageFactory(rfMessageFactory); }
private void parseApplicationIds(String appIdsStr) { if(appIdsStr != null) { appIdsStr = appIdsStr.replaceAll(" ", ""); String[] appIdsStrings = appIdsStr.split(","); acctApplicationIds = new ArrayList<ApplicationId>(appIdsStrings.length); for(String appId : appIdsStrings) { String[] vendorAndAppId = appId.split(":"); acctApplicationIds.add(ApplicationId.createByAccAppId(Long.valueOf(vendorAndAppId[0]), Long.valueOf(vendorAndAppId[1]))); } } }
private void performBeforeReturnGx(final GxClientSessionActivityImpl acc, Session session) { GxMessageFactoryImpl messageFactory = new GxMessageFactoryImpl(baseMessageFactory, session.getSessionId(), stack); // Set the first configured Application-Id as default for message factory ApplicationId firstAppId = authApplicationIds.get(0); messageFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId()); acc.setGxMessageFactory(messageFactory); }