<commit_before>/*
 *  Copyright (c) 2008-2015
 *      NES <<EMAIL>>
 *
 *  All rights reserved. This source file is the sole property of NES, and
 *  contain proprietary and confidential information related to NES.
 *
 *  Licensed under the NES RED License, Version 1.0 (the "License"); you may
 *  not use this file except in compliance with the License. You may obtain a
 *  copy of the License bundled along with this file. Any kind of reproduction
 *  or duplication of any part of this file which conflicts with the License
 *  without prior written consent from NES is strictly prohibited.
 *
 *  Unless required by applicable law and agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  License for the specific language governing permissions and limitations
 *  under the License.
 */
//set ts=4 sw=4

#ifndef __STP_MAIN_C__
#	define __STP_MAIN_C__


#include "ieee8021SpanningTreeMib_agent.h"
#include "ieee8021MstpMib_agent.h"

#include "stp_ext.h"
#include "stp_defines.h"
#include "switch_ext.h"

#include "lib/thread.h"


static xThreadInfo_t oStpThread =
{
	.u32Index = XTHREAD_ID (ModuleId_stp_c, 0),
	.u8SchedPolicy = SCHED_RR,
	.u8Priority = 1,
	.poStart = &stp_start,
};


void *
stp_main (
	void *pvArgv)
{
	ieee8021SpanningTreeMib_init ();
	ieee8021MstpMib_init ();
	
	if (xThread_create (&oStpThread) == NULL)
	{
		Stp_log (xLog_err_c, "xThread_create() failed\n");
		return NULL;
	}
	
	return NULL;
}

void *
stp_start (
	void *pvArgv)
{
	while (1)
	{
		xThread_sleep (1);
	}
	return NULL;
}


#endif	// __STP_MAIN_C__<commit_msg>[nes]: STP changes ...<commit_after>/*
 *  Copyright (c) 2008-2015
 *      NES <<EMAIL>>
 *
 *  All rights reserved. This source file is the sole property of NES, and
 *  contain proprietary and confidential information related to NES.
 *
 *  Licensed under the NES RED License, Version 1.0 (the "License"); you may
 *  not use this file except in compliance with the License. You may obtain a
 *  copy of the License bundled along with this file. Any kind of reproduction
 *  or duplication of any part of this file which conflicts with the License
 *  without prior written consent from NES is strictly prohibited.
 *
 *  Unless required by applicable law and agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  License for the specific language governing permissions and limitations
 *  under the License.
 */
//set ts=4 sw=4

#ifndef __STP_MAIN_C__
#	define __STP_MAIN_C__


#include "ieee8021SpanningTreeMib_agent.h"
#include "ieee8021MstpMib_agent.h"

#include "stp_ext.h"
#include "stp_defines.h"
#include "switch_ext.h"

#include "lib/bitmap.h"
#include "lib/sync.h"
#include "lib/message.h"
#include "lib/thread.h"


static xThreadInfo_t oStpThread =
{
	.u32Index = XTHREAD_ID (ModuleId_stp_c, 0),
	.u8SchedPolicy = SCHED_RR,
	.u8Priority = 1,
	.poStart = &stp_start,
};

static xMessageQueue_t *poStpMessageQueue = NULL;


void *
stp_main (
	void *pvArgv)
{
	ieee8021SpanningTreeMib_init ();
	ieee8021MstpMib_init ();
	
	if ((poStpMessageQueue = xMessageQueue_create (oStpThread.u32Index)) == NULL)
	{
		return NULL;
	}
	
	if (xThread_create (&oStpThread) == NULL)
	{
		Stp_log (xLog_err_c, "xThread_create() failed\n");
		return NULL;
	}
	
	return NULL;
}

void *
stp_start (
	void *pvArgv)
{
	xThread_waitPrepare (&oStpThread);
	
	while (xThread_wait (&oStpThread, NULL))
	{
		if (xBitmap_getBit (oStpThread.au8Flags, xThreadInfo_flagsMessage_c))
		{
			register xMessage_t *poMsg = NULL;
			
			while ((poMsg = xMessageAck_getMessage (poStpMessageQueue)) != NULL)
			{
				/* TODO */
				
				if (!xMessageAck_remove (poMsg, poStpMessageQueue))
				{
					break;
				}
			}
			
			while ((poMsg = xMessageDst_getMessage (poStpMessageQueue)) != NULL)
			{
				/* TODO */
				
				switch (poMsg->poMsgInfo->u32Type)
				{
				default:
					break;
				}
				
				if (!xMessageDst_remove (poMsg, poStpMessageQueue))
				{
					break;
				}
			}
			
			xMessage_cleanupThread (poStpMessageQueue, &oStpThread);
		}
	}
	
	return NULL;
}


#endif	// __STP_MAIN_C__
{'fraction_non_alphanumeric': 0.0972998137802607, 'fraction_numerical': 0.017458100558659217, 'mean_word_length': 3.7116228070175437, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1250167', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1509, 'n_words': 452}