nsresult nsCMSSecureMessage:: decode(const char *data, unsigned char **result, PRInt32 * _retval) { PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode\n")); nsresult rv = NS_OK; PRUint32 len = PL_strlen(data); int adjust = 0; /* Compute length adjustment */ if (data[len-1] == '=') { adjust++; if (data[len-2] == '=') adjust++; } *result = (unsigned char *)PL_Base64Decode(data, len, NULL); if (!*result) { PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode - error decoding base64\n")); rv = NS_ERROR_ILLEGAL_VALUE; goto loser; } *_retval = (len*3)/4 - adjust; loser: return rv; }
void DIR_SetServerFileName(DIR_Server *server) { char * tempName = nsnull; const char * prefName = nsnull; PRUint32 numHeaderBytes = 0; if (server && (!server->fileName || !(*server->fileName)) ) { PR_FREEIF(server->fileName); // might be one byte empty string. /* make sure we have a pref name...*/ if (!server->prefName || !*server->prefName) server->prefName = dir_CreateServerPrefName(server); /* set default personal address book file name*/ if ((server->position == 1) && (server->dirType == PABDirectory)) server->fileName = strdup(kPersonalAddressbook); else if ((server->position == 1) && (server->dirType == IMDirectory)) server->fileName = strdup(kIMAddressbook); else { /* now use the pref name as the file name since we know the pref name will be unique */ prefName = server->prefName; if (prefName && *prefName) { /* extract just the pref name part and not the ldap tree name portion from the string */ numHeaderBytes = PL_strlen(PREF_LDAP_SERVER_TREE_NAME) + 1; /* + 1 for the '.' b4 the name */ if (PL_strlen(prefName) > numHeaderBytes) tempName = strdup(prefName + numHeaderBytes); if (tempName) { server->fileName = PR_smprintf("%s%s", tempName, kABFileName_CurrentSuffix); PR_Free(tempName); } } } if (!server->fileName || !*server->fileName) /* when all else has failed, generate a default name */ { if (server->dirType == LDAPDirectory) DIR_SetFileName(&(server->fileName), kMainLdapAddressBook); /* generates file name with an ldap prefix */ else DIR_SetFileName(&(server->fileName), kPersonalAddressbook); } } }
// Stream is done...drive on! NS_IMETHODIMP nsMsgSendLater::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status) { nsresult rv; // First, this shouldn't happen, but if // it does, flush the buffer and move on. if (mLeftoverBuffer) { DeliverQueuedLine(mLeftoverBuffer, PL_strlen(mLeftoverBuffer)); } if (mOutFile) mOutFile->Close(); // See if we succeeded on reading the message from the message store? // if (NS_SUCCEEDED(status)) { // Message is done...send it! rv = CompleteMailFileSend(); #ifdef NS_DEBUG printf("nsMsgSendLater: Success on getting message...\n"); #endif // If the send operation failed..try the next one... if (NS_FAILED(rv)) { rv = StartNextMailFileSend(rv); if (NS_FAILED(rv)) EndSendMessages(rv, nullptr, mTotalSendCount, mTotalSentSuccessfully); } } else { nsCOMPtr<nsIChannel> channel = do_QueryInterface(request); if(!channel) return NS_ERROR_FAILURE; // extract the prompt object to use for the alert from the url.... nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIPrompt> promptObject; if (channel) { channel->GetURI(getter_AddRefs(uri)); nsCOMPtr<nsISmtpUrl> smtpUrl (do_QueryInterface(uri)); if (smtpUrl) smtpUrl->GetPrompt(getter_AddRefs(promptObject)); } nsMsgDisplayMessageByID(promptObject, NS_ERROR_QUEUED_DELIVERY_FAILED); // Getting the data failed, but we will still keep trying to send the rest... rv = StartNextMailFileSend(status); if (NS_FAILED(rv)) EndSendMessages(rv, nullptr, mTotalSendCount, mTotalSentSuccessfully); } return rv; }
// returns -1 if this box is not part of this namespace, // or the length of the prefix if it is part of this namespace int nsIMAPNamespace::MailboxMatchesNamespace(const char *boxname) { if (!boxname) return -1; // If the namespace is part of the boxname if (!m_prefix || !*m_prefix) return 0; if (PL_strstr(boxname, m_prefix) == boxname) return PL_strlen(m_prefix); // If the boxname is part of the prefix // (Used for matching Personal mailbox with Personal/ namespace, etc.) if (PL_strstr(m_prefix, boxname) == m_prefix) return PL_strlen(boxname); return -1; }
static void appendsOFile(OFile *fp, const char *s) { int i, slen; slen = PL_strlen (s); for (i=0; i<slen; i++) { appendcOFile(fp,s[i]); } }
// given rootURI and rootURI##folder, return on-disk path of folder nsresult nsLocalURI2Path(const char* rootURI, const char* uriStr, nsCString& pathResult) { nsresult rv; // verify that rootURI starts with "mailbox:/" or "mailbox-message:/" if ((PL_strcmp(rootURI, kMailboxRootURI) != 0) && (PL_strcmp(rootURI, kMailboxMessageRootURI) != 0)) { return NS_ERROR_FAILURE; } // verify that uristr starts with rooturi nsCAutoString uri(uriStr); if (uri.Find(rootURI) != 0) return NS_ERROR_FAILURE; nsCOMPtr<nsIMsgIncomingServer> server; rv = nsLocalURI2Server(uriStr, getter_AddRefs(server)); if (NS_FAILED(rv)) return rv; // now ask the server what it's root is // and begin pathResult with the mailbox root nsCOMPtr<nsIFile> localPath; rv = server->GetLocalPath(getter_AddRefs(localPath)); NS_ENSURE_SUCCESS(rv, rv); nsCString localNativePath; localPath->GetNativePath(localNativePath); nsEscapeNativePath(localNativePath); pathResult = localNativePath.get(); const char *curPos = uriStr + PL_strlen(rootURI); if (curPos) { // advance past hostname while ((*curPos)=='/') curPos++; while (*curPos && (*curPos)!='/') curPos++; nsCAutoString newPath(""); // Unescape folder name if (curPos) { nsCString unescapedStr; MsgUnescapeString(nsDependentCString(curPos), 0, unescapedStr); NS_MsgCreatePathStringFromFolderURI(unescapedStr.get(), newPath, NS_LITERAL_CSTRING("none")); } else NS_MsgCreatePathStringFromFolderURI(curPos, newPath, NS_LITERAL_CSTRING("none")); pathResult.Append('/'); pathResult.Append(newPath); } return NS_OK; }
int nsMsgSendPart::AppendOtherHeaders(const char* more) { if (!m_other) return SetOtherHeaders(more); if (!more || !*more) return 0; char* tmp = (char *) PR_Malloc(sizeof(char) * (PL_strlen(m_other) + PL_strlen(more) + 2)); if (!tmp) return NS_ERROR_OUT_OF_MEMORY; PL_strcpy(tmp, m_other); PL_strcat(tmp, more); PR_FREEIF(m_other); m_other = tmp; return 0; }
PL_strrstr(const char *big, const char *little) { const char *p; PRUint32 ll; if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0; if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0; ll = PL_strlen(little); p = &big[ PL_strlen(big) - ll ]; if( p < big ) return (char *)0; for( ; p >= big; p-- ) if( *little == *p ) if( 0 == PL_strncmp(p, little, ll) ) return (char *)p; return (char *)0; }
nsresult nsCreateImapBaseMessageURI(const nsACString& baseURI, nsCString &baseMessageURI) { nsCAutoString tailURI(baseURI); // chop off imap:/ if (tailURI.Find(kImapRootURI) == 0) tailURI.Cut(0, PL_strlen(kImapRootURI)); baseMessageURI = kImapMessageRootURI; baseMessageURI += tailURI; return NS_OK; }
PL_strcaserstr(const char *big, const char *little) { const char *p; PRUint32 ll; if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0; if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0; ll = PL_strlen(little); p = &big[ PL_strlen(big) - ll ]; if( p < big ) return (char *)0; for( ; p >= big; p-- ) /* obvious improvement available here */ if( 0 == PL_strncasecmp(p, little, ll) ) return (char *)p; return (char *)0; }
int32_t nsIMAPBodypart::GenerateMIMEHeader(nsIMAPBodyShell *aShell, bool stream, bool prefetch) { if (prefetch && !m_headerData) { QueuePrefetchMIMEHeader(aShell); return 0; } else if (m_headerData) { int32_t mimeHeaderLength = 0; if (!ShouldFetchInline(aShell)) { // if this part isn't inline, add the X-Mozilla-IMAP-Part header char *xPartHeader = PR_smprintf("%s: %s", IMAP_EXTERNAL_CONTENT_HEADER, m_partNumberString); if (xPartHeader) { if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-XHeader",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(xPartHeader, false); } mimeHeaderLength += PL_strlen(xPartHeader); PR_Free(xPartHeader); } } mimeHeaderLength += PL_strlen(m_headerData); if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-MIMEHeader",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(m_headerData, false); // all one line? Can we do that? } return mimeHeaderLength; } else { SetIsValid(false); // prefetch didn't adopt a MIME header return 0; } }
// static xptiFileType::Type xptiFileType::GetType(const char* name) { NS_ASSERTION(name, "loser!"); int len = PL_strlen(name); for(const xptiFileTypeEntry* p = g_Entries; p->name; p++) { if(len > p->len && 0 == PL_strcasecmp(p->name, &(name[len - p->len]))) return p->type; } return UNKNOWN; }
COMclass COMfindComponent (const char *className) { const char *prefix = "urn:"; const char *modulePrefix = "swarm/"; size_t prefixLen = PL_strlen (prefix); size_t modulePrefixLen = PL_strlen (modulePrefix); nsCID *cClass = new nsCID (); size_t classNameLen = PL_strlen (className); char *buf = (char *) malloc (prefixLen + classNameLen + 1); if (!buf) abort (); nsresult rv; PL_strcpy (buf, prefix); PL_strcat (buf, className); if (PL_strncmp (className, modulePrefix, modulePrefixLen) == 0) { unsigned i; buf[prefixLen + 5] = ':'; for (i = modulePrefixLen; i < classNameLen; i++) { unsigned pos = prefixLen + i; if (buf[pos] == '/') buf[pos] = '.'; } } nsCOMPtr<nsIComponentManager> compMgr; NS_GetComponentManager (getter_AddRefs (compMgr)); if (!compMgr) abort (); nsCOMPtr<nsIComponentManagerObsolete> compMgrO = do_QueryInterface (compMgr); rv = compMgrO->ContractIDToClassID (buf, cClass); free (buf); if (NS_FAILED (rv)) abort (); return (COMclass) cClass; }
static DIR_PrefId DIR_AtomizePrefName(const char *prefname) { if (!prefname) return idNone; DIR_PrefId rc = idNone; /* Skip the "ldap_2.servers.<server-name>." portion of the string. */ if (PL_strstr(prefname, PREF_LDAP_SERVER_TREE_NAME) == prefname) { prefname = PL_strchr(&prefname[PL_strlen(PREF_LDAP_SERVER_TREE_NAME) + 1], '.'); if (!prefname) return idNone; else prefname = prefname + 1; } switch (prefname[0]) { case 'd': switch (prefname[1]) { case 'e': /* description */ rc = idDescription; break; case 'i': /* dirType */ rc = idType; break; } break; case 'f': rc = idFileName; break; case 'p': switch (prefname[1]) { case 'o': switch (prefname[2]) { case 's': /* position */ rc = idPosition; break; } break; } break; case 'u': /* uri */ rc = idUri; break; } return rc; }
int32_t nsIMAPBodypart::GenerateBoundary(nsIMAPBodyShell *aShell, bool stream, bool prefetch, bool lastBoundary) { if (prefetch) return 0; // don't need to prefetch anything if (m_boundaryData) { if (!lastBoundary) { if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-Boundary",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(m_boundaryData, false); } return PL_strlen(m_boundaryData); } else // the last boundary { char *lastBoundaryData = PR_smprintf("%s--", m_boundaryData); if (lastBoundaryData) { if (stream) { aShell->GetConnection()->Log("SHELL","GENERATE-Boundary-Last",m_partNumberString); aShell->GetConnection()->HandleMessageDownLoadLine(lastBoundaryData, false); } int32_t rv = PL_strlen(lastBoundaryData); PR_Free(lastBoundaryData); return rv; } else { //HandleMemoryFailure(); return 0; } } } else return 0; }
nsresult nsCreateLocalBaseMessageURI(const nsACString& baseURI, nsCString &baseMessageURI) { nsCAutoString tailURI(baseURI); // chop off mailbox:/ if (tailURI.Find(kMailboxRootURI) == 0) tailURI.Cut(0, PL_strlen(kMailboxRootURI)); baseMessageURI = kMailboxMessageRootURI; baseMessageURI += tailURI; return NS_OK; }
nsresult nsCreateNewsBaseMessageURI(const char *baseURI, nsCString &baseMessageURI) { nsAutoCString tailURI(baseURI); // chop off news:/ if (tailURI.Find(kNewsRootURI) == 0) tailURI.Cut(0, PL_strlen(kNewsRootURI)); baseMessageURI = kNewsMessageRootURI; baseMessageURI += tailURI; return NS_OK; }
/* * FUNCTION: pkix_pl_UInt32_Overflows * DESCRIPTION: * * Returns a PKIX_Boolean indicating whether the unsigned integer * represented by "string" is too large to fit in 32-bits (i.e. * whether it overflows). With the exception of the string "0", * all other strings are stripped of any leading zeros. It is assumed * that every character in "string" is from the set {'0' - '9'}. * * PARAMETERS * "string" * Address of array of bytes representing PKIX_UInt32 that's being tested * for 32-bit overflow * THREAD SAFETY: * Thread Safe (see Thread Safety Definitions in Programmer's Guide) * RETURNS: * PKIX_TRUE if PKIX_UInt32 represented by "string" overflows; * PKIX_FALSE otherwise */ PKIX_Boolean pkix_pl_UInt32_Overflows(char *string){ char *firstNonZero = NULL; PKIX_UInt32 length, i; char *MAX_UINT32_STRING = "4294967295"; PKIX_DEBUG_ENTER(OID); PKIX_OID_DEBUG("\tCalling PL_strlen).\n"); length = PL_strlen(string); if (length < MAX_DIGITS_32){ return (PKIX_FALSE); } firstNonZero = string; for (i = 0; i < length; i++){ if (*string == '0'){ firstNonZero++; } } PKIX_OID_DEBUG("\tCalling PL_strlen).\n"); length = PL_strlen(firstNonZero); if (length > MAX_DIGITS_32){ return (PKIX_TRUE); } PKIX_OID_DEBUG("\tCalling PL_strlen).\n"); if (length == MAX_DIGITS_32){ PKIX_OID_DEBUG("\tCalling PORT_Strcmp).\n"); if (PORT_Strcmp(firstNonZero, MAX_UINT32_STRING) > 0){ return (PKIX_TRUE); } } return (PKIX_FALSE); }
static char * AppendAndAlloc(char *string, const char *newSubstring, bool withComma) { if (!newSubstring) return NULL; if (!string) return PL_strdup(newSubstring); char *separator = (char *) (withComma ? ", " : " "); char *oldString = string; string = (char *)PR_Calloc(PL_strlen(oldString) + PL_strlen(separator) + PL_strlen(newSubstring) + 1, sizeof(char)); PL_strcpy(string, oldString); PL_strcat(string, separator); PL_strcat(string, newSubstring); PR_Free(oldString); return string; }
NS_IMETHODIMP nsNSSCertificateDB::FindCertByDBKey(const char *aDBkey, nsISupports *aToken, nsIX509Cert **_cert) { nsNSSShutDownPreventionLock locker; SECItem keyItem = {siBuffer, nsnull, 0}; SECItem *dummy; CERTIssuerAndSN issuerSN; unsigned long moduleID,slotID; *_cert = nsnull; if (!aDBkey || !*aDBkey) return NS_ERROR_INVALID_ARG; dummy = NSSBase64_DecodeBuffer(nsnull, &keyItem, aDBkey, (PRUint32)PL_strlen(aDBkey)); if (!dummy || keyItem.len < NS_NSS_LONG*4) { PR_FREEIF(keyItem.data); return NS_ERROR_INVALID_ARG; } CERTCertificate *cert; // someday maybe we can speed up the search using the moduleID and slotID moduleID = NS_NSS_GET_LONG(keyItem.data); slotID = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG]); // build the issuer/SN structure issuerSN.serialNumber.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*2]); issuerSN.derIssuer.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*3]); if (issuerSN.serialNumber.len == 0 || issuerSN.derIssuer.len == 0 || issuerSN.serialNumber.len + issuerSN.derIssuer.len != keyItem.len - NS_NSS_LONG*4) { PR_FREEIF(keyItem.data); return NS_ERROR_INVALID_ARG; } issuerSN.serialNumber.data= &keyItem.data[NS_NSS_LONG*4]; issuerSN.derIssuer.data= &keyItem.data[NS_NSS_LONG*4+ issuerSN.serialNumber.len]; cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(), &issuerSN); PR_FREEIF(keyItem.data); if (cert) { nsNSSCertificate *nssCert = new nsNSSCertificate(cert); CERT_DestroyCertificate(cert); if (nssCert == nsnull) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(nssCert); *_cert = static_cast<nsIX509Cert*>(nssCert); } return NS_OK; }
SSLNamedGroup groupNameToNamedGroup(char *name) { if (PL_strlen(name) == 4) { if (!strncmp(name, "P256", 4)) { return ssl_grp_ec_secp256r1; } if (!strncmp(name, "P384", 4)) { return ssl_grp_ec_secp384r1; } if (!strncmp(name, "P521", 4)) { return ssl_grp_ec_secp521r1; } } if (PL_strlen(name) == 6) { if (!strncmp(name, "x25519", 6)) { return ssl_grp_ec_curve25519; } if (!strncmp(name, "FF2048", 6)) { return ssl_grp_ffdhe_2048; } if (!strncmp(name, "FF3072", 6)) { return ssl_grp_ffdhe_3072; } if (!strncmp(name, "FF4096", 6)) { return ssl_grp_ffdhe_4096; } if (!strncmp(name, "FF6144", 6)) { return ssl_grp_ffdhe_6144; } if (!strncmp(name, "FF8192", 6)) { return ssl_grp_ffdhe_8192; } } return ssl_grp_none; }
static nsresult pref_DoCallback(const char* changed_pref) { nsresult rv = NS_OK; struct CallbackNode* node; bool reentered = gCallbacksInProgress; gCallbacksInProgress = true; // Nodes must not be deleted while gCallbacksInProgress is true. // Nodes that need to be deleted are marked for deletion by nulling // out the |func| pointer. We release them at the end of this function // if we haven't reentered. for (node = gCallbacks; node != NULL; node = node->next) { if ( node->func && PL_strncmp(changed_pref, node->domain, PL_strlen(node->domain)) == 0 ) { nsresult rv2 = (*node->func) (changed_pref, node->data); if (NS_FAILED(rv2)) rv = rv2; } } gCallbacksInProgress = reentered; if (gShouldCleanupDeadNodes && !gCallbacksInProgress) { struct CallbackNode* prev_node = NULL; node = gCallbacks; while (node != NULL) { if (!node->func) { node = pref_RemoveCallbackNode(node, prev_node); } else { prev_node = node; node = node->next; } } gShouldCleanupDeadNodes = false; } return rv; }
static char *catDirName(char *platform, char *dir, void *plContext) { char *pathName = NULL; PKIX_UInt32 dirLen; PKIX_UInt32 platformLen; PKIX_TEST_STD_VARS(); dirLen = PL_strlen(dir); platformLen = PL_strlen(platform); PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc (platformLen + dirLen + 2, (void **)&pathName, plContext)); PL_strcpy(pathName, platform); PL_strcat(pathName, "/"); PL_strcat(pathName, dir); cleanup: PKIX_TEST_RETURN(); return (pathName); }
const char * COMcopyString (const char *str) { if (str) { const char *ret = (const char *) nsMemory::Clone (str, sizeof (char) * (PL_strlen (str) + 1)); if (!ret) abort (); return ret; } else return NULL; }
static void lexPushLookahead(char *s, int len) { int putptr; if (len == 0) len = PL_strlen(s); putptr = lexBuf.getPtr - len; /* this function assumes that length of word to push back * is not greater than PR_MAX_LEX_LOOKAHEAD. */ if (putptr < 0) putptr += PR_MAX_LEX_LOOKAHEAD; lexBuf.getPtr = putptr; while (*s) { lexBuf.buf[putptr] = *s++; putptr = (putptr + 1) % PR_MAX_LEX_LOOKAHEAD; } lexBuf.len += len; }
nsresult nsMsgSendLater::BuildNewBuffer(const char* aBuf, uint32_t aCount, uint32_t *totalBufSize) { // Only build a buffer when there are leftovers... if (!mLeftoverBuffer) return NS_ERROR_FAILURE; int32_t leftoverSize = PL_strlen(mLeftoverBuffer); mLeftoverBuffer = (char *)PR_Realloc(mLeftoverBuffer, aCount + leftoverSize); if (!mLeftoverBuffer) return NS_ERROR_FAILURE; memcpy(mLeftoverBuffer + leftoverSize, aBuf, aCount); *totalBufSize = aCount + leftoverSize; return NS_OK; }
PL_strstr(const char *big, const char *little) { PRUint32 ll; if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0; if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0; ll = PL_strlen(little); for( ; *big; big++ ) if( *little == *big ) if( 0 == PL_strncmp(big, little, ll) ) return (char *)big; return (char *)0; }
PL_strcasestr(const char *big, const char *little) { PRUint32 ll; if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0; if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0; ll = PL_strlen(little); for( ; *big; big++ ) /* obvious improvement available here */ if( 0 == PL_strncasecmp(big, little, ll) ) return (char *)big; return (char *)0; }
char* dupStr(const char *s, unsigned int size) { char *t; if (size == 0) { size = PL_strlen(s); } t = (char*)PR_CALLOC(size+1); if (t) { memcpy(t,s,size); t[size] = 0; return t; } else { return (char*)0; } }
PR_IMPLEMENT(PLOptState*) PL_CreateLongOptState( PRIntn argc, char **argv, const char *options, const PLLongOpt *longOpts) { PLOptState *opt = NULL; PLOptionInternal *internal; if (NULL == options) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return opt; } opt = PR_NEWZAP(PLOptState); if (NULL == opt) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); return opt; } internal = PR_NEW(PLOptionInternal); if (NULL == internal) { PR_DELETE(opt); PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); return NULL; } opt->option = 0; opt->value = NULL; opt->internal = internal; opt->longOption = 0; opt->longOptIndex = -1; internal->argc = argc; internal->argv = argv; internal->xargc = 0; internal->xargv = &static_Nul; internal->minus = 0; internal->options = options; internal->longOpts = longOpts; internal->endOfOpts = PR_FALSE; internal->optionsLen = PL_strlen(options); return opt; } /* PL_CreateLongOptState */